Home / Function/ serialize() — fastapi Function Reference

serialize() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1dc99bde_e086_531f_f13c_0f42087dd407["serialize()"]
  413233b4_cb0b_062e_c20b_4dfc7c774216["ModelField"]
  1dc99bde_e086_531f_f13c_0f42087dd407 -->|defined in| 413233b4_cb0b_062e_c20b_4dfc7c774216
  style 1dc99bde_e086_531f_f13c_0f42087dd407 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/_compat/v2.py lines 158–181

    def serialize(
        self,
        value: Any,
        *,
        mode: Literal["json", "python"] = "json",
        include: Union[IncEx, None] = None,
        exclude: Union[IncEx, None] = None,
        by_alias: bool = True,
        exclude_unset: bool = False,
        exclude_defaults: bool = False,
        exclude_none: bool = False,
    ) -> Any:
        # What calls this code passes a value that already called
        # self._type_adapter.validate_python(value)
        return self._type_adapter.dump_python(
            value,
            mode=mode,
            include=include,
            exclude=exclude,
            by_alias=by_alias,
            exclude_unset=exclude_unset,
            exclude_defaults=exclude_defaults,
            exclude_none=exclude_none,
        )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free