Home / File/ test_response_model_include_exclude.py — fastapi Source File

test_response_model_include_exclude.py — fastapi Source File

Architecture documentation for test_response_model_include_exclude.py, a python file in the fastapi codebase. 3 imports, 0 dependents.

File python FastAPI Routing 3 imports 12 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  e9d6e2c1_1fb5_3aa4_5028_7db5fa279f57["test_response_model_include_exclude.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  e9d6e2c1_1fb5_3aa4_5028_7db5fa279f57 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  e9d6e2c1_1fb5_3aa4_5028_7db5fa279f57 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  e9d6e2c1_1fb5_3aa4_5028_7db5fa279f57 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style e9d6e2c1_1fb5_3aa4_5028_7db5fa279f57 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel


class Model1(BaseModel):
    foo: str
    bar: str


class Model2(BaseModel):
    ref: Model1
    baz: str


class Model3(BaseModel):
    name: str
    age: int
    ref2: Model2


app = FastAPI()


@app.get(
    "/simple_include",
    response_model=Model2,
    response_model_include={"baz": ..., "ref": {"foo"}},
)
def simple_include():
    return Model2(
        ref=Model1(foo="simple_include model foo", bar="simple_include model bar"),
        baz="simple_include model2 baz",
    )


@app.get(
    "/simple_include_dict",
    response_model=Model2,
    response_model_include={"baz": ..., "ref": {"foo"}},
)
def simple_include_dict():
    return {
        "ref": {
            "foo": "simple_include_dict model foo",
            "bar": "simple_include_dict model bar",
        },
        "baz": "simple_include_dict model2 baz",
    }


@app.get(
    "/simple_exclude",
    response_model=Model2,
    response_model_exclude={"ref": {"bar"}},
)
def simple_exclude():
    return Model2(
        ref=Model1(foo="simple_exclude model foo", bar="simple_exclude model bar"),
        baz="simple_exclude model2 baz",
// ... (116 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_response_model_include_exclude.py do?
test_response_model_include_exclude.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_response_model_include_exclude.py?
test_response_model_include_exclude.py defines 12 function(s): mixed, mixed_dict, simple_exclude, simple_exclude_dict, simple_include, simple_include_dict, test_nested_exclude_simple, test_nested_exclude_simple_dict, test_nested_include_mixed, test_nested_include_mixed_dict, and 2 more.
What does test_response_model_include_exclude.py depend on?
test_response_model_include_exclude.py imports 3 module(s): __init__.py, pydantic, testclient.py.
Where is test_response_model_include_exclude.py in the architecture?
test_response_model_include_exclude.py is located at tests/test_response_model_include_exclude.py (domain: FastAPI, subdomain: Routing, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free