mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19:06 +00:00
server: fix openapi generation with duplicate route for audio/mp3
This commit is contained in:
@@ -100,7 +100,10 @@ def use_route_names_as_operation_ids(app: FastAPI) -> None:
|
||||
version = None
|
||||
if route.path.startswith("/v"):
|
||||
version = route.path.split("/")[1]
|
||||
opid = f"{version}_{route.name}"
|
||||
if route.operation_id is not None:
|
||||
opid = f"{version}_{route.operation_id}"
|
||||
else:
|
||||
opid = f"{version}_{route.name}"
|
||||
else:
|
||||
opid = route.name
|
||||
|
||||
@@ -110,7 +113,7 @@ def use_route_names_as_operation_ids(app: FastAPI) -> None:
|
||||
"Please rename the route or the view function."
|
||||
)
|
||||
route.operation_id = opid
|
||||
ensure_uniq_operation_ids.add(route.name)
|
||||
ensure_uniq_operation_ids.add(opid)
|
||||
|
||||
|
||||
use_route_names_as_operation_ids(app)
|
||||
|
||||
@@ -18,8 +18,14 @@ from ._range_requests_response import range_requests_response
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/transcripts/{transcript_id}/audio/mp3")
|
||||
@router.head("/transcripts/{transcript_id}/audio/mp3")
|
||||
@router.get(
|
||||
"/transcripts/{transcript_id}/audio/mp3",
|
||||
operation_id="transcript_get_audio_mp3",
|
||||
)
|
||||
@router.head(
|
||||
"/transcripts/{transcript_id}/audio/mp3",
|
||||
operation_id="transcript_head_audio_mp3",
|
||||
)
|
||||
async def transcript_get_audio_mp3(
|
||||
request: Request,
|
||||
transcript_id: str,
|
||||
|
||||
Reference in New Issue
Block a user