This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
FastAPI==0.89.0 Cannot use None
as a return type when status_code
is set to 204 with from __future__ import annotations
#5859
Labels
First Check
Commit to Help
Example Code
Description
If we add:
from __future__ import annotations
It changes the annotations structure and the response model is
NoneType
instead ofNone
, which causes validation of thestatuc_code
vsresponse_model
and raises an exception.I am working on a fix for it right now.
Operating System
macOS
Operating System Details
No response
FastAPI Version
0.89.0
Python Version
3.10
Additional Context
No response
The text was updated successfully, but these errors were encountered: