Home / Function/ get_flat_dependant() — fastapi Function Reference

get_flat_dependant() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  df2bd000_d29c_ac4b_5eca_426e3122a385["get_flat_dependant()"]
  9e602cbf_3139_86ae_5666_97b8806942de["utils.py"]
  df2bd000_d29c_ac4b_5eca_426e3122a385 -->|defined in| 9e602cbf_3139_86ae_5666_97b8806942de
  ae5e875d_4a7a_fe4f_43bc_0f9490438b9f["get_flat_params()"]
  ae5e875d_4a7a_fe4f_43bc_0f9490438b9f -->|calls| df2bd000_d29c_ac4b_5eca_426e3122a385
  affeac09_7707_a8d9_d9a7_6ca9b7066460["_get_openapi_operation_parameters()"]
  affeac09_7707_a8d9_d9a7_6ca9b7066460 -->|calls| df2bd000_d29c_ac4b_5eca_426e3122a385
  200f313e_38b9_296f_f9aa_afdeacb6b8ad["get_openapi_path()"]
  200f313e_38b9_296f_f9aa_afdeacb6b8ad -->|calls| df2bd000_d29c_ac4b_5eca_426e3122a385
  0df3979a_d2ac_6dd9_1bb1_6629b89a941b["__init__()"]
  0df3979a_d2ac_6dd9_1bb1_6629b89a941b -->|calls| df2bd000_d29c_ac4b_5eca_426e3122a385
  d8b4fb83_3521_0b7e_fcfa_0c7f161ca116["__init__()"]
  d8b4fb83_3521_0b7e_fcfa_0c7f161ca116 -->|calls| df2bd000_d29c_ac4b_5eca_426e3122a385
  style df2bd000_d29c_ac4b_5eca_426e3122a385 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/dependencies/utils.py lines 126–177

def get_flat_dependant(
    dependant: Dependant,
    *,
    skip_repeats: bool = False,
    visited: Optional[list[DependencyCacheKey]] = None,
    parent_oauth_scopes: Optional[list[str]] = None,
) -> Dependant:
    if visited is None:
        visited = []
    visited.append(dependant.cache_key)
    use_parent_oauth_scopes = (parent_oauth_scopes or []) + (
        dependant.oauth_scopes or []
    )

    flat_dependant = Dependant(
        path_params=dependant.path_params.copy(),
        query_params=dependant.query_params.copy(),
        header_params=dependant.header_params.copy(),
        cookie_params=dependant.cookie_params.copy(),
        body_params=dependant.body_params.copy(),
        name=dependant.name,
        call=dependant.call,
        request_param_name=dependant.request_param_name,
        websocket_param_name=dependant.websocket_param_name,
        http_connection_param_name=dependant.http_connection_param_name,
        response_param_name=dependant.response_param_name,
        background_tasks_param_name=dependant.background_tasks_param_name,
        security_scopes_param_name=dependant.security_scopes_param_name,
        own_oauth_scopes=dependant.own_oauth_scopes,
        parent_oauth_scopes=use_parent_oauth_scopes,
        use_cache=dependant.use_cache,
        path=dependant.path,
        scope=dependant.scope,
    )
    for sub_dependant in dependant.dependencies:
        if skip_repeats and sub_dependant.cache_key in visited:
            continue
        flat_sub = get_flat_dependant(
            sub_dependant,
            skip_repeats=skip_repeats,
            visited=visited,
            parent_oauth_scopes=flat_dependant.oauth_scopes,
        )
        flat_dependant.dependencies.append(flat_sub)
        flat_dependant.path_params.extend(flat_sub.path_params)
        flat_dependant.query_params.extend(flat_sub.query_params)
        flat_dependant.header_params.extend(flat_sub.header_params)
        flat_dependant.cookie_params.extend(flat_sub.cookie_params)
        flat_dependant.body_params.extend(flat_sub.body_params)
        flat_dependant.dependencies.extend(flat_sub.dependencies)

    return flat_dependant

Subdomains

Frequently Asked Questions

What does get_flat_dependant() do?
get_flat_dependant() is a function in the fastapi codebase, defined in fastapi/dependencies/utils.py.
Where is get_flat_dependant() defined?
get_flat_dependant() is defined in fastapi/dependencies/utils.py at line 126.
What calls get_flat_dependant()?
get_flat_dependant() is called by 5 function(s): __init__, __init__, _get_openapi_operation_parameters, get_flat_params, get_openapi_path.

Analyze Your Own Codebase

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

Try Supermodel Free