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

12 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1from fastapi import FastAPI 1abcd

2from pydantic import BaseModel 1abcd

3 

4 

5class Item(BaseModel): 1abcd

6 name: str 1abcd

7 description: str | None = None 1abcd

8 

9 

10app = FastAPI(separate_input_output_schemas=False) 1abcd

11 

12 

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

14def create_item(item: Item): 1abcd

15 return item 1efgh

16 

17 

18@app.get("/items/") 1abcd

19def read_items() -> list[Item]: 1abcd

20 return [ 1ijkl

21 Item( 

22 name="Portal Gun", 

23 description="Device to travel through the multi-rick-verse", 

24 ), 

25 Item(name="Plumbus"), 

26 ]