| 1 |
from fastapi import FastAPI |
| 2 |
from pydantic.v1 import BaseModel |
| 3 |
|
| 4 |
|
| 5 |
class Item(BaseModel): |
| 6 |
name: str |
| 7 |
description: str | None = None |
| 8 |
size: float |
| 9 |
|
| 10 |
|
| 11 |
app = FastAPI() |
| 12 |
|
| 13 |
|
| 14 |
@app.post("/items/") |
| 15 |
async def create_item(item: Item) -> Item: |
| 16 |
return item |