Coverage for docs_src / separate_openapi_schemas / tutorial001_py310.py: 100%

12 statements  

« 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

3 

4 

5class Item(BaseModel): 1abhicdefg

6 name: str 1abcdefg

7 description: str | None = None 1abhicdefg

8 

9 

10app = FastAPI() 1abhicdefg

11 

12 

13@app.post("/items/") 1abhicdefg

14def create_item(item: Item): 1abhicdefg

15 return item 1jklm

16 

17 

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 ]