Home / Function/ asdict() — fastapi Function Reference

asdict() — fastapi Function Reference

Architecture documentation for the asdict() function in v2.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  1a429df6_f813_ef37_c0e6_58f50f452ff7["asdict()"]
  3e134d50_38c1_8523_f518_6686c1d9752b["v2.py"]
  1a429df6_f813_ef37_c0e6_58f50f452ff7 -->|defined in| 3e134d50_38c1_8523_f518_6686c1d9752b
  eba6f1ce_1c5f_6206_5659_da76ae8122e0["__post_init__()"]
  eba6f1ce_1c5f_6206_5659_da76ae8122e0 -->|calls| 1a429df6_f813_ef37_c0e6_58f50f452ff7
  style 1a429df6_f813_ef37_c0e6_58f50f452ff7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/_compat/v2.py lines 68–78

def asdict(field_info: FieldInfo) -> dict[str, Any]:
    attributes = {}
    for attr in _Attrs:
        value = getattr(field_info, attr, Undefined)
        if value is not Undefined:
            attributes[attr] = value
    return {
        "annotation": field_info.annotation,
        "metadata": field_info.metadata,
        "attributes": attributes,
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does asdict() do?
asdict() is a function in the fastapi codebase, defined in fastapi/_compat/v2.py.
Where is asdict() defined?
asdict() is defined in fastapi/_compat/v2.py at line 68.
What calls asdict()?
asdict() is called by 1 function(s): __post_init__.

Analyze Your Own Codebase

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

Try Supermodel Free