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

Implemented response_model_exclude_defaults and response_model_exclude_none #1166

Merged
merged 2 commits into from
Apr 5, 2020

Conversation

voegtlel
Copy link
Contributor

Implemented response_model_exclude_defaults and response_model_exclude_none to support these pydantic options.

@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1166   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          225       226    +1     
  Lines         6733      6783   +50     
=========================================
+ Hits          6733      6783   +50     
Impacted Files Coverage Δ
fastapi/applications.py 100.00% <ø> (ø)
fastapi/encoders.py 100.00% <ø> (ø)
fastapi/openapi/utils.py 100.00% <100.00%> (ø)
fastapi/routing.py 100.00% <100.00%> (ø)
tests/test_jsonable_encoder.py 100.00% <100.00%> (ø)
tests/test_skip_defaults.py 100.00% <100.00%> (ø)
...orial/test_sql_databases/test_testing_databases.py 100.00% <0.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 14b467d...2baf454. Read the comment docs.

@voegtlel voegtlel force-pushed the feature/exclude_defaults_none branch 2 times, most recently from 378510f to 653f32d Compare April 2, 2020 15:44
@voegtlel voegtlel force-pushed the feature/exclude_defaults_none branch from 653f32d to dcb3e35 Compare April 2, 2020 15:44
@tiangolo tiangolo merged commit 3397d4d into fastapi:master Apr 5, 2020
@tiangolo
Copy link
Member

tiangolo commented Apr 5, 2020

Great job @voegtlel ! 🙇‍♂️ 👏 🤓

Thanks for keeping the changes minimal and for adding all the tests. ✔️

I think it's okay to deprecate include_none and use instead the inverted exclude_none to keep in sync with Pydantic, so I updated that bit.

Thanks for your contribution! 🍰 🚀

tiangolo added a commit that referenced this pull request Jun 13, 2020
* Documented additional parameters

These are included in a recent PR (#1166) but not in the docs yet.
* response_model_exclude_none
* response_model_exclude_defaults

* 📝 Update note about response_model_exclude_defaults and response_model_exclude_none

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