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
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-05 00:03 +0000
1from typing import List 1abcdef
3from fastapi import FastAPI 1abcdef
4from pydantic import BaseModel 1abcdef
6app = FastAPI() 1abcdef
9class Item(BaseModel): 1abcdef
10 name: str 1abcdef
11 description: str 1abcdef
14items = [ 1abcdef
15 {"name": "Foo", "description": "There comes my hero"},
16 {"name": "Red", "description": "It's my aeroplane"},
17]
20@app.get("/items/", response_model=List[Item]) 1abcdef
21async def read_items(): 1abcdef
22 return items 1ghijkl