Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for test_invalid_none (0.07 sec)

  1. 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)
Back to top