mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
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.
15 lines
421 B
Python
15 lines
421 B
Python
from fastapi import APIRouter, Depends
|
|
|
|
from game import Game
|
|
from .models import SupplyRouteJs
|
|
from ..dependencies import GameContext
|
|
|
|
router: APIRouter = APIRouter(prefix="/supply-routes")
|
|
|
|
|
|
@router.get("/", operation_id="list_supply_routes", response_model=list[SupplyRouteJs])
|
|
def list_supply_routes(
|
|
game: Game = Depends(GameContext.require),
|
|
) -> list[SupplyRouteJs]:
|
|
return SupplyRouteJs.all_in_game(game)
|