Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for get_invalid (0.15 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`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 03 23:25:42 GMT 2024
    - 388.1K bytes
    - Viewed (1)
Back to top