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

12 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from fastapi import FastAPI 1abc

2from pydantic import BaseModel 1abc

3 

4 

5class Item(BaseModel): 1abc

6 name: str 1abc

7 description: str | None = None 1abc

8 

9 

10app = FastAPI() 1abc

11 

12 

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

14def create_item(item: Item): 1abc

15 return item 1abc

16 

17 

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

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

20 return [ 1abc

21 Item( 

22 name="Portal Gun", 

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

24 ), 

25 Item(name="Plumbus"), 

26 ]