Skip to content

Fix union body - #400

Merged
tiangolo merged 3 commits into
fastapi:masterfrom
koxudaxi:fix_union_body
Aug 7, 2019
Merged

tiangolo merged 3 commits into
fastapi:masterfrom
koxudaxi:fix_union_body

Conversation

@koxudaxi

Copy link
Copy Markdown
Contributor

The PR fix union body bug.

Detail

FastAPI can't handle a body as union type.
I found parameter detected condition is wrong, which don't care union type.

Related issue

#300

@codecov

codecov Bot commented Jul 22, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #400 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #400   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         238    240    +2     
  Lines        5566   5626   +60     
=====================================
+ Hits         5566   5626   +60
Impacted Files Coverage Δ
tests/test_union_body.py 100% <100%> (ø)
tests/test_union_inherited_body.py 100% <100%> (ø)
fastapi/dependencies/utils.py 100% <100%> (ø) ⬆️

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 6ca3ce8...00e2bf2. Read the comment docs.

@tiangolo
tiangolo merged commit 06eb421 into fastapi:master Aug 7, 2019
@tiangolo

tiangolo commented Aug 7, 2019

Copy link
Copy Markdown
Member

Thank you @koxudaxi ! Great job debugging and finding the problem. 🍰 🚀

I just updated the implementation a bit to avoid the internal declaration of a sub-function and added a couple of comments in the tests to clarify why Unions with inheritance are only supported in Python 3.7.

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.

2 participants