Browse Source

fix: deterministic operationId when route has multiple methods fixes #13175

pull/15070/head
Sandesh Bhandari 4 months ago
parent
commit
4c744c8663
  1. 2
      fastapi/utils.py

2
fastapi/utils.py

@ -96,7 +96,7 @@ def generate_unique_id(route: "APIRoute") -> str:
operation_id = f"{route.name}{route.path_format}" operation_id = f"{route.name}{route.path_format}"
operation_id = re.sub(r"\W", "_", operation_id) operation_id = re.sub(r"\W", "_", operation_id)
assert route.methods assert route.methods
operation_id = f"{operation_id}_{list(route.methods)[0].lower()}" operation_id = f"{operation_id}_{sorted(route.methods)[0].lower()}"
return operation_id return operation_id

Loading…
Cancel
Save