8000 ✅ Update response_model_by_alias by tiangolo · Pull Request #1642 · fastapi/fastapi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Update response_model_by_alias #1642

Merged
merged 7 commits into from
Jun 28, 2020

Conversation

tiangolo
Copy link
Member
@tiangolo tiangolo commented Jun 28, 2020

Update logic for response_model_by_alias to apply it only to the response_model, not to the object returned by the function.

And update tests with a small note in the tests clarifying (so I don't forget) that response_model_by_alias=False is basically just a quick hack that doesn't support OpenAPI.

The proper way to do it if the intention is to have OpenAPI support is to create another model (possibly inheriting from the original one).

This supersedes #1412

@github-actions
Copy link
Contributor

@codecov
Copy link
codecov bot commented Jun 28, 2020

Codecov Report

Merging #1642 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1642   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          236       237    +1     
  Lines         7068      7157   +89     
=========================================
+ Hits          7068      7157   +89     
Impacted Files Coverage Δ
fastapi/routing.py 100.00% <ø> (ø)
tests/test_duplicate_models_openapi.py 100.00% <100.00%> (ø)
tests/test_response_by_alias.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50926fa...fd1f804. Read the comment docs.

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@tiangolo tiangolo merged commit e5594e8 into master Jun 28, 2020
@tiangolo tiangolo deleted the update-tests-response-model-by-alias branch June 28, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0