Browse Source

🎨 Auto format

pull/15327/head
pre-commit-ci-lite[bot] 3 months ago
committed by GitHub
parent
commit
e58ea05743
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      fastapi/openapi/utils.py

6
fastapi/openapi/utils.py

@ -242,14 +242,14 @@ def get_openapi_operation_metadata(
operation["summary"] = generate_operation_summary(route=route, method=method)
if route.description:
operation["description"] = route.description
# Start with explicit operation_id or unique_id
operation_id = route.operation_id or route.unique_id
# For multi-method routes, append the method if the unique_id alone would be a duplicate
if operation_id in operation_ids:
operation_id = f"{route.unique_id}_{method.lower()}"
if operation_id in operation_ids:
endpoint_name = getattr(route.endpoint, "__name__", "<unnamed_endpoint>")
message = f"Duplicate Operation ID {operation_id} for function {endpoint_name}"

Loading…
Cancel
Save