Coverage for docs_src/extra_models/tutorial004.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from typing import List 1abcde
3from fastapi import FastAPI 1abcde
4from pydantic import BaseModel 1abcde
6app = FastAPI() 1abcde
9class Item(BaseModel): 1abcde
10 name: str 1abcde
11 description: str 1abcde
14items = [ 1abcde
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]) 1abcde
21async def read_items(): 1abcde
22 return items 1abcde