mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add metadata to FastAPI endpoints for OpenAPI.
operation_ids give us better function names when generating the typescript API from the openapi.json. BaseModel.Config.title does the same for type names. Response models (or 204 status codes) need to be explicit or the API will be declared as returning any.
This commit is contained in:
@@ -8,7 +8,11 @@ from ..dependencies import GameContext, QtCallbacks, QtContext
|
||||
router: APIRouter = APIRouter(prefix="/qt")
|
||||
|
||||
|
||||
@router.post("/create-package/front-line/{front_line_id}")
|
||||
@router.post(
|
||||
"/create-package/front-line/{front_line_id}",
|
||||
operation_id="open_new_front_line_package_dialog",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
)
|
||||
def new_front_line_package(
|
||||
front_line_id: UUID,
|
||||
game: Game = Depends(GameContext.require),
|
||||
@@ -17,7 +21,11 @@ def new_front_line_package(
|
||||
qt.create_new_package(game.db.front_lines.get(front_line_id))
|
||||
|
||||
|
||||
@router.post("/create-package/tgo/{tgo_id}")
|
||||
@router.post(
|
||||
"/create-package/tgo/{tgo_id}",
|
||||
operation_id="open_new_tgo_package_dialog",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
)
|
||||
def new_tgo_package(
|
||||
tgo_id: UUID,
|
||||
game: Game = Depends(GameContext.require),
|
||||
@@ -26,7 +34,11 @@ def new_tgo_package(
|
||||
qt.create_new_package(game.db.tgos.get(tgo_id))
|
||||
|
||||
|
||||
@router.post("/info/tgo/{tgo_id}")
|
||||
@router.post(
|
||||
"/info/tgo/{tgo_id}",
|
||||
operation_id="open_tgo_info_dialog",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
)
|
||||
def show_tgo_info(
|
||||
tgo_id: UUID,
|
||||
game: Game = Depends(GameContext.require),
|
||||
@@ -35,7 +47,11 @@ def show_tgo_info(
|
||||
qt.show_tgo_info(game.db.tgos.get(tgo_id))
|
||||
|
||||
|
||||
@router.post("/create-package/control-point/{cp_id}")
|
||||
@router.post(
|
||||
"/create-package/control-point/{cp_id}",
|
||||
operation_id="open_new_control_point_package_dialog",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
)
|
||||
def new_cp_package(
|
||||
cp_id: int,
|
||||
game: Game = Depends(GameContext.require),
|
||||
@@ -50,7 +66,11 @@ def new_cp_package(
|
||||
qt.create_new_package(cp)
|
||||
|
||||
|
||||
@router.post("/info/control-point/{cp_id}")
|
||||
@router.post(
|
||||
"/info/control-point/{cp_id}",
|
||||
operation_id="open_control_point_info_dialog",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
)
|
||||
def show_control_point_info(
|
||||
cp_id: int,
|
||||
game: Game = Depends(GameContext.require),
|
||||
|
||||
Reference in New Issue
Block a user