lqs
d20566fe07
Some checks failed
Test / lint (push) Has been cancelled
Test / test (pydantic-v1, 3.10) (push) Has been cancelled
Test / test (pydantic-v1, 3.11) (push) Has been cancelled
Test / test (pydantic-v1, 3.12) (push) Has been cancelled
Test / test (pydantic-v1, 3.8) (push) Has been cancelled
Test / test (pydantic-v1, 3.9) (push) Has been cancelled
Test / test (pydantic-v2, 3.10) (push) Has been cancelled
Test / test (pydantic-v2, 3.11) (push) Has been cancelled
Test / test (pydantic-v2, 3.12) (push) Has been cancelled
Test / test (pydantic-v2, 3.8) (push) Has been cancelled
Test / test (pydantic-v2, 3.9) (push) Has been cancelled
Test / coverage-combine (push) Has been cancelled
Test / check (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Label Approved / label-approved (push) Has been cancelled
27 lines
549 B
Python
27 lines
549 B
Python
from dataclasses import dataclass, field
|
|
from typing import List, Union
|
|
|
|
from fastapi import FastAPI
|
|
|
|
|
|
@dataclass
|
|
class Item:
|
|
name: str
|
|
price: float
|
|
tags: List[str] = field(default_factory=list)
|
|
description: Union[str, None] = None
|
|
tax: Union[float, None] = None
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/next", response_model=Item)
|
|
async def read_next_item():
|
|
return {
|
|
"name": "Island In The Moon",
|
|
"price": 12.99,
|
|
"description": "A place to be playin' and havin' fun",
|
|
"tags": ["breater"],
|
|
}
|