Home / Function/ get_openapi_operation_metadata() — fastapi Function Reference

get_openapi_operation_metadata() — fastapi Function Reference

Architecture documentation for the get_openapi_operation_metadata() function in utils.py from the fastapi codebase.

Function python FastAPI Applications calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  ff95ab0c_7f10_f29e_f615_ea529a87d199["get_openapi_operation_metadata()"]
  0dcb823f_ea0d_bd04_752b_a3a3f875bba1["utils.py"]
  ff95ab0c_7f10_f29e_f615_ea529a87d199 -->|defined in| 0dcb823f_ea0d_bd04_752b_a3a3f875bba1
  200f313e_38b9_296f_f9aa_afdeacb6b8ad["get_openapi_path()"]
  200f313e_38b9_296f_f9aa_afdeacb6b8ad -->|calls| ff95ab0c_7f10_f29e_f615_ea529a87d199
  e35d5571_306c_8110_d63a_a8234d913fdc["generate_operation_summary()"]
  ff95ab0c_7f10_f29e_f615_ea529a87d199 -->|calls| e35d5571_306c_8110_d63a_a8234d913fdc
  1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0["get()"]
  ff95ab0c_7f10_f29e_f615_ea529a87d199 -->|calls| 1b892f95_174f_a6fa_5ff9_9cd8b88e8ee0
  style ff95ab0c_7f10_f29e_f615_ea529a87d199 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/openapi/utils.py lines 237–260

def get_openapi_operation_metadata(
    *, route: routing.APIRoute, method: str, operation_ids: set[str]
) -> dict[str, Any]:
    operation: dict[str, Any] = {}
    if route.tags:
        operation["tags"] = route.tags
    operation["summary"] = generate_operation_summary(route=route, method=method)
    if route.description:
        operation["description"] = route.description
    operation_id = route.operation_id or route.unique_id
    if operation_id in operation_ids:
        message = (
            f"Duplicate Operation ID {operation_id} for function "
            + f"{route.endpoint.__name__}"
        )
        file_name = getattr(route.endpoint, "__globals__", {}).get("__file__")
        if file_name:
            message += f" at {file_name}"
        warnings.warn(message, stacklevel=1)
    operation_ids.add(operation_id)
    operation["operationId"] = operation_id
    if route.deprecated:
        operation["deprecated"] = route.deprecated
    return operation

Domain

Subdomains

Called By

Frequently Asked Questions

What does get_openapi_operation_metadata() do?
get_openapi_operation_metadata() is a function in the fastapi codebase, defined in fastapi/openapi/utils.py.
Where is get_openapi_operation_metadata() defined?
get_openapi_operation_metadata() is defined in fastapi/openapi/utils.py at line 237.
What does get_openapi_operation_metadata() call?
get_openapi_operation_metadata() calls 2 function(s): generate_operation_summary, get.
What calls get_openapi_operation_metadata()?
get_openapi_operation_metadata() is called by 1 function(s): get_openapi_path.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free