Home / Function/ create_body_model() — fastapi Function Reference

create_body_model() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b189d385_4449_f021_4e07_ad1c8ed18252["create_body_model()"]
  3e134d50_38c1_8523_f518_6686c1d9752b["v2.py"]
  b189d385_4449_f021_4e07_ad1c8ed18252 -->|defined in| 3e134d50_38c1_8523_f518_6686c1d9752b
  style b189d385_4449_f021_4e07_ad1c8ed18252 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/_compat/v2.py lines 329–334

def create_body_model(
    *, fields: Sequence[ModelField], model_name: str
) -> type[BaseModel]:
    field_params = {f.name: (f.field_info.annotation, f.field_info) for f in fields}
    BodyModel: type[BaseModel] = create_model(model_name, **field_params)  # type: ignore[call-overload]
    return BodyModel

Domain

Subdomains

Frequently Asked Questions

What does create_body_model() do?
create_body_model() is a function in the fastapi codebase, defined in fastapi/_compat/v2.py.
Where is create_body_model() defined?
create_body_model() is defined in fastapi/_compat/v2.py at line 329.

Analyze Your Own Codebase

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

Try Supermodel Free