-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow return type of endpoint to be response model #5216
Allow return type of endpoint to be response model #5216
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5216 +/- ##
===========================================
- Coverage 100.00% 99.98% -0.02%
===========================================
Files 532 533 +1
Lines 13684 13728 +44
===========================================
+ Hits 13684 13726 +42
- Misses 0 2 +2
Continue to review full report at Codecov.
|
📝 Docs preview for commit 8a07b01 at: https://62e6d9aef71fda183aa15bc0--fastapi.netlify.app |
…ttps://github.com/JarroVGIT/fastapi into allow_return_type_of_endpoint_to_be_response_model
📝 Docs preview for commit d6efeb6 at: https://62e6dfaef9d4021787025f37--fastapi.netlify.app |
📝 Docs preview for commit d790941 at: https://62e6e959ab662b1a31cc19ed--fastapi.netlify.app |
This has been discussed and rejected in #101 :( |
Based on the discussion here:
Fixes #5215
This would allow the developer to choose between using something like
and
The latter is more idiomatic. In this PR, the
reponse_model=
method takes precedence, as all documentation is in that style. That means if both are set, then the return type will be ignored.