test_openapi_separate_input_output_schemas.py — fastapi Source File
Architecture documentation for test_openapi_separate_input_output_schemas.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 97adeb06_a3f2_aa0f_0da8_64acee359394["test_openapi_separate_input_output_schemas.py"] 0dda2280_3359_8460_301c_e98c77e78185["typing"] 97adeb06_a3f2_aa0f_0da8_64acee359394 --> 0dda2280_3359_8460_301c_e98c77e78185 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 97adeb06_a3f2_aa0f_0da8_64acee359394 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 97adeb06_a3f2_aa0f_0da8_64acee359394 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 97adeb06_a3f2_aa0f_0da8_64acee359394 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a 6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"] 97adeb06_a3f2_aa0f_0da8_64acee359394 --> 6913fbd4_39df_d14b_44bb_522e99b65b90 style 97adeb06_a3f2_aa0f_0da8_64acee359394 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Optional
from fastapi import FastAPI
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from pydantic import BaseModel, computed_field
class SubItem(BaseModel):
subname: str
sub_description: Optional[str] = None
tags: list[str] = []
model_config = {"json_schema_serialization_defaults_required": True}
class Item(BaseModel):
name: str
description: Optional[str] = None
sub: Optional[SubItem] = None
model_config = {"json_schema_serialization_defaults_required": True}
class WithComputedField(BaseModel):
name: str
@computed_field
@property
def computed_field(self) -> str:
return f"computed {self.name}"
def get_app_client(separate_input_output_schemas: bool = True) -> TestClient:
app = FastAPI(separate_input_output_schemas=separate_input_output_schemas)
@app.post("/items/", responses={402: {"model": Item}})
def create_item(item: Item) -> Item:
return item
@app.post("/items-list/")
def create_item_list(item: list[Item]):
return item
@app.get("/items/")
def read_items() -> list[Item]:
return [
Item(
name="Portal Gun",
description="Device to travel through the multi-rick-verse",
sub=SubItem(subname="subname"),
),
Item(name="Plumbus"),
]
@app.post("/with-computed-field/")
def create_with_computed_field(
with_computed_field: WithComputedField,
) -> WithComputedField:
return with_computed_field
client = TestClient(app)
// ... (619 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- __init__.py
- inline_snapshot
- pydantic
- testclient.py
- typing
Source
Frequently Asked Questions
What does test_openapi_separate_input_output_schemas.py do?
test_openapi_separate_input_output_schemas.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_openapi_separate_input_output_schemas.py?
test_openapi_separate_input_output_schemas.py defines 8 function(s): get_app_client, test_create_item, test_create_item_list, test_create_item_with_sub, test_openapi_schema, test_openapi_schema_no_separate, test_read_items, test_with_computed_field.
What does test_openapi_separate_input_output_schemas.py depend on?
test_openapi_separate_input_output_schemas.py imports 5 module(s): __init__.py, inline_snapshot, pydantic, testclient.py, typing.
Where is test_openapi_separate_input_output_schemas.py in the architecture?
test_openapi_separate_input_output_schemas.py is located at tests/test_openapi_separate_input_output_schemas.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