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