- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for save_union_body (0.07 sec)
-
tests/test_union_body.py
from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: Optional[str] = None class OtherItem(BaseModel): price: int @app.post("/items/") def save_union_body(item: Union[OtherItem, Item]): return {"item": item} client = TestClient(app) def test_post_other_item(): response = client.post("/items/", json={"price": 100})
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 4.3K bytes - Viewed (0)