- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for get_valid_none (0.14 sec)
-
tests/test_validate_response.py
def get_invalid(): return {"name": "invalid", "price": "foo"} @app.get("/items/invalidnone", response_model=Item) def get_invalid_none(): return None @app.get("/items/validnone", response_model=Union[Item, None]) def get_valid_none(send_none: bool = False): if send_none: return None else: return {"name": "invalid", "price": 3.2}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 2K bytes - Viewed (0) -
docs/en/docs/release-notes.md
class Item(BaseModel): name: str price: Optional[float] = None owner_ids: Optional[List[int]] = None app = FastAPI() @app.get("/items/invalidnone", response_model=Item) def get_invalid_none(): return None ``` ...calling the path `/items/invalidnone` will raise an error, because `None` is not a valid type for the `response_model` declared with `Item`.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Nov 01 11:25:57 UTC 2024 - 460.3K bytes - Viewed (0)