Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix custom response input output schema bug #11517

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

slafs
Copy link
Sponsor

@slafs slafs commented May 2, 2024

This PR addresses the issue (point 1.) from #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 #10697 (point 2.)

slafs added 2 commits May 2, 2024 15:07
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
tiangolo#10697
slafs added a commit to slafs/fastapi that referenced this pull request May 2, 2024
As documented in https://coverage.readthedocs.io/en/7.5.0/contexts.html#dynamic-contexts

While working on tiangolo#11517 I wanted to see which test
is best to modify for the fix.
One way to easily find this out is to see which line is covered
by which test.

This PR adds a dynamic context setting
and makes them show on the HTML coverage report.
The contexts are test function names.

NOTE pytest-cov plugin has even better support
for pytest test names as coverage contexts,
but I think this PR is already an imporovement.
@alejsdev alejsdev added the bug Something isn't working label May 4, 2024
@alejsdev alejsdev changed the title Fix custom response input output schema bug 馃悰 Fix custom response input output schema bug May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants