MCPcopy
hub / github.com/fastapi/fastapi / get_openapi_operation_metadata

Function get_openapi_operation_metadata

fastapi/openapi/utils.py:236–257  ·  view source on GitHub ↗
(
    *, route: routing._APIRouteLike, method: str, operation_ids: set[str]
)

Source from the content-addressed store, hash-verified

234
235
236def get_openapi_operation_metadata(
237 *, route: routing._APIRouteLike, method: str, operation_ids: set[str]
238) -> dict[str, Any]:
239 operation: dict[str, Any] = {}
240 if route.tags:
241 operation["tags"] = route.tags
242 operation["summary"] = generate_operation_summary(route=route, method=method)
243 if route.description:
244 operation["description"] = route.description
245 operation_id = route.operation_id or route.unique_id
246 if operation_id in operation_ids:
247 endpoint_name = getattr(route.endpoint, "__name__", "<unnamed_endpoint>")
248 message = f"Duplicate Operation ID {operation_id} for function {endpoint_name}"
249 file_name = getattr(route.endpoint, "__globals__", {}).get("__file__")
250 if file_name:
251 message += f" at {file_name}"
252 warnings.warn(message, stacklevel=1)
253 operation_ids.add(operation_id)
254 operation["operationId"] = operation_id
255 if route.deprecated:
256 operation["deprecated"] = route.deprecated
257 return operation
258
259
260def get_openapi_path(

Callers 1

get_openapi_pathFunction · 0.85

Calls 2

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…