This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
recover response_model from output annotations #4734
Labels
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
I think it will be nice if the type in response_model (in the app decorators) will be infered from the output annotation of the function.
By doing so you can avoid some documentation-code inconsistency.
Wanted Solution
When response_model is None it will try to use the annotation one, es by using
self.response_model= response_model or get_output_annotation(fn)
Will be the same as
Wanted Code
Alternatives
No response
Operating System
Windows
Operating System Details
Windows 11
FastAPI Version
0.75.0
Python Version
Python 3.10.4
Additional Context
No response
The text was updated successfully, but these errors were encountered: