Coverage for docs_src/extra_models/tutorial004_py39.py: 100%

10 statements  

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

1from fastapi import FastAPI 1abcd

2from pydantic import BaseModel 1abcd

3 

4app = FastAPI() 1abcd

5 

6 

7class Item(BaseModel): 1abcd

8 name: str 1abcd

9 description: str 1abcd

10 

11 

12items = [ 1abcd

13 {"name": "Foo", "description": "There comes my hero"}, 

14 {"name": "Red", "description": "It's my aeroplane"}, 

15] 

16 

17 

18@app.get("/items/", response_model=list[Item]) 1abcd

19async def read_items(): 1abcd

20 return items 1abcd