tiangolo / fastapi

FastAPI framework, high performance, easy to learn, fast to code, ready for production
https://fastapi.tiangolo.com/
MIT License
73.34k stars 6.18k forks source link

🐛 Fix custom response input output schema bug #11517

Open slafs opened 2 months ago

slafs commented 2 months ago

This PR addresses the issue (point 1.) from https://github.com/tiangolo/fastapi/discussions/10697

Add missing mode argument when calling create_response_field for "custom" response models defined in the responses option of a route. The same way we do that for the "main" response model on line 475.

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 https://github.com/tiangolo/fastapi/discussions/10697 (point 2.)

slafs commented 3 weeks ago

@alejsdev any chance on approving/merging this? 😬