Coverage for docs_src / separate_openapi_schemas / tutorial002_py310.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1from fastapi import FastAPI 1abhicdefg
2from pydantic import BaseModel 1abhicdefg
5class Item(BaseModel): 1abhicdefg
6 name: str 1abcdefg
7 description: str | None = None 1abhicdefg
10app = FastAPI(separate_input_output_schemas=False) 1abhicdefg
13@app.post("/items/") 1abhicdefg
14def create_item(item: Item): 1abhicdefg
15 return item 1jklm
18@app.get("/items/") 1abhicdefg
19def read_items() -> list[Item]: 1abhicdefg
20 return [ 1nopq
21 Item(
22 name="Portal Gun",
23 description="Device to travel through the multi-rick-verse",
24 ),
25 Item(name="Plumbus"),
26 ]