Код: Выделить всё
api/locations?code={str}&guid={str}&path={str}
Код: Выделить всё
@router.get("/api/locations")
def get_functional_locations(
guid: Optional[str] = None,
code: Optional[str] = None,
path: Optional[str] = None,
) -> Union[List[Locations], PlainTextResponse]:
if guid:
return ...
if path:
return ...
if code:
return ...
return PlainTextResponse(status_code=status.HTTP_400_BAD_REQUEST)
Подробнее здесь: https://stackoverflow.com/questions/760 ... in-fastapi