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

Fix exclude_unset and aliases in response model validation. #1074

Merged
merged 2 commits into from Mar 27, 2020
Merged

Fix exclude_unset and aliases in response model validation. #1074

merged 2 commits into from Mar 27, 2020

Conversation

ghost
Copy link

@ghost ghost commented Mar 3, 2020

Should fix both #1043 and #1063, but might come with some performance penalty since unnecessary serialization is being done. Better solutions that pass the given tests are more than welcome, but I don't see a much better way other than recursion in cases where there are models inside basic data structures like lists and dicts.

@codecov
Copy link

codecov bot commented Mar 3, 2020

Codecov Report

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

Impacted file tree graph

@@             Coverage Diff             @@
##            master     #1074     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files          331       223    -108     
  Lines         8085      6642   -1443     
===========================================
- Hits          8085      6642   -1443     
Impacted Files Coverage Δ
fastapi/routing.py 100.00% <100.00%> (ø)
tests/test_serialize_response_model.py 100.00% <100.00%> (ø)
docs/src/bigger_applications/app/routers/users.py
docs/src/custom_response/tutorial006.py
docs/src/sql_databases/sql_app/database.py
...cs/src/query_params_str_validations/tutorial012.py
...th_operation_advanced_configuration/tutorial001.py
docs/src/extra_models/tutorial005.py
docs/src/additional_responses/tutorial001.py
docs/src/extending_openapi/tutorial001.py
... and 102 more

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 025b38d...1d2b874. Read the comment docs.

fastapi/routing.py Outdated Show resolved Hide resolved
@tiangolo tiangolo merged commit aea04ee into tiangolo:master Mar 27, 2020
@tiangolo
Copy link
Owner

Excellent job @juhovh-aiven ! 👏 🤓

Thanks for your contribution! 🍰 🚀

And thanks @Kilo59 for the review 🤓 🕵️‍♂️ 🔍

hyahiaoui pushed a commit to hyahiaoui/fastapi that referenced this pull request Aug 1, 2020
…o#1074)

* Fix exclude_unset and aliases in response model validation.

* ✨ Use by_alias from param 🤷

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
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.

None yet

2 participants