tutorial003_py39.py — fastapi Source File
Architecture documentation for tutorial003_py39.py, a python file in the fastapi codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3734bafa_43cf_440d_a6ca_1b8941b24432["tutorial003_py39.py"] 4cff5a35_9399_b238_3d2b_e2cca82878e1["dataclasses"] 3734bafa_43cf_440d_a6ca_1b8941b24432 --> 4cff5a35_9399_b238_3d2b_e2cca82878e1 0dda2280_3359_8460_301c_e98c77e78185["typing"] 3734bafa_43cf_440d_a6ca_1b8941b24432 --> 0dda2280_3359_8460_301c_e98c77e78185 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 3734bafa_43cf_440d_a6ca_1b8941b24432 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 a913f820_c954_4542_736a_45cc1a22c6fd["pydantic.dataclasses"] 3734bafa_43cf_440d_a6ca_1b8941b24432 --> a913f820_c954_4542_736a_45cc1a22c6fd style 3734bafa_43cf_440d_a6ca_1b8941b24432 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from dataclasses import field # (1)
from typing import Union
from fastapi import FastAPI
from pydantic.dataclasses import dataclass # (2)
@dataclass
class Item:
name: str
description: Union[str, None] = None
@dataclass
class Author:
name: str
items: list[Item] = field(default_factory=list) # (3)
app = FastAPI()
@app.post("/authors/{author_id}/items/", response_model=Author) # (4)
async def create_author_items(author_id: str, items: list[Item]): # (5)
return {"name": author_id, "items": items} # (6)
@app.get("/authors/", response_model=list[Author]) # (7)
def get_authors(): # (8)
return [ # (9)
{
"name": "Breaters",
"items": [
{
"name": "Island In The Moon",
"description": "A place to be playin' and havin' fun",
},
{"name": "Holy Buddies"},
],
},
{
"name": "System of an Up",
"items": [
{
"name": "Salt",
"description": "The kombucha mushroom people's favorite",
},
{"name": "Pad Thai"},
{
"name": "Lonely Night",
"description": "The mostests lonliest nightiest of allest",
},
],
},
]
Domain
Subdomains
Functions
Dependencies
- __init__.py
- dataclasses
- pydantic.dataclasses
- typing
Source
Frequently Asked Questions
What does tutorial003_py39.py do?
tutorial003_py39.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Responses subdomain.
What functions are defined in tutorial003_py39.py?
tutorial003_py39.py defines 2 function(s): create_author_items, get_authors.
What does tutorial003_py39.py depend on?
tutorial003_py39.py imports 4 module(s): __init__.py, dataclasses, pydantic.dataclasses, typing.
Where is tutorial003_py39.py in the architecture?
tutorial003_py39.py is located at docs_src/dataclasses_/tutorial003_py39.py (domain: FastAPI, subdomain: Responses, directory: docs_src/dataclasses_).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free