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

11 statements  

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

1from typing import List 1abcdef

2 

3from fastapi import FastAPI 1abcdef

4from pydantic import BaseModel 1abcdef

5 

6app = FastAPI() 1abcdef

7 

8 

9class Item(BaseModel): 1abcdef

10 name: str 1abcdef

11 description: str 1abcdef

12 

13 

14items = [ 1abcdef

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

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

17] 

18 

19 

20@app.get("/items/", response_model=List[Item]) 1abcdef

21async def read_items(): 1abcdef

22 return items 1ghijkl