🐛 Fix custom response input output schema bug#11517
🐛 Fix custom response input output schema bug#11517slafs wants to merge 5 commits intofastapi:masterfrom slafs:fix-custom-response-input-output-schema-bug
Conversation
Which should be "serialization" also for custom response models defined in the `responses` option. The same way we do that for the "main" response model on line 475. This fixes issue 1. mentioned in #10697
|
@alejsdev any chance on approving/merging this? 😬 |
|
Hi @slafs, thank you for your interest in contributing to FastAPI. We have a high volume of PRs, we're reviewing and classifying them. We'll come back to review your PR in detail, we appreciate your patience as we manage the queue. 🙇♀️ |
|
Seems like a duplicate of #10895. Would love to see any of PRs the merged. :) |
|
Oh yeah. Cool. Although, I feel my test is more explicit about the custom |
svlandeg
left a comment
There was a problem hiding this comment.
Hi @slafs,
Thanks for the contribution, and apologies for the delay in reviewing this!
Your unit tests & example code from #10697 clearly demonstrate the issue. I could reproduce the bug on master and confirm that the test fails on master and succeeds with this PR.
Because #10895 contains the same fix and was submitted earlier, I would suggest to merge that one and close this one. I have pushed your test to that PR as well though, as I agree that this test is slightly more clear.
I will leave this up to Tiangolo for a final review and then we'll hopefully be able to merge the fix soon 🙏
Thanks again!
This PR addresses the issue (point 1.) from #10697
Add missing
modeargument when callingcreate_model_fieldfor "custom" response models defined in the
responsesoption of a route.The same way we do that for the "main" response model (see the other call of
create_model_field).Otherwise that custom response model schema (if separate i/o models are enabled)
is generated with the "-Input" suffix (instead of
-Output).NOTE this PR doesn't address docs issues that are mentioned in #10697 (point 2.)