Coverage for docs_src/body/tutorial001.py: 100%
12 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 Union 1abcde
3from fastapi import FastAPI 1abcde
4from pydantic import BaseModel 1abcde
7class Item(BaseModel): 1abcde
8 name: str 1abcde
9 description: Union[str, None] = None 1abcde
10 price: float 1abcde
11 tax: Union[float, None] = None 1abcde
14app = FastAPI() 1abcde
17@app.post("/items/") 1abcde
18async def create_item(item: Item): 1abcde
19 return item 1abcde