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 Enum handling with their own schema definitions #1463

Merged
merged 5 commits into from
May 23, 2020

Conversation

tiangolo
Copy link
Owner

🐛 Fix Enum handling with their own schema definitions.

I missed an error in #1461 , the story is a bit more complex. This currently breaks Swagger UI when using enums in other parts apart from bodies (e.g. path params).

It's necessary to add enums to the whole handling with OpenAPI of models to include the new definition in the components.

These changes plus a couple of updates in pydantic/pydantic#1432 work correctly in Swagger UI and generate an independent schema for enums (which was the original intention).

@github-actions
Copy link
Contributor

@codecov
Copy link

codecov bot commented May 23, 2020

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1463   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          227       227           
  Lines         6807      6810    +3     
=========================================
+ Hits          6807      6810    +3     
Impacted Files Coverage Δ
...test_tutorial/test_path_params/test_tutorial005.py 100.00% <ø> (ø)
fastapi/dependencies/utils.py 100.00% <100.00%> (ø)
fastapi/openapi/utils.py 100.00% <100.00%> (ø)
fastapi/utils.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 98bb9f1...6751321. Read the comment docs.

@tiangolo tiangolo merged commit 5984233 into master May 23, 2020
@tiangolo tiangolo deleted the enum-own-schema branch May 23, 2020 16:56
hyahiaoui pushed a commit to hyahiaoui/fastapi that referenced this pull request Aug 1, 2020
* 🐛 Fix extra support for enum with its own schema

* ✅ Fix/update test for enum with its own schema

* 🐛 Fix type declarations

* 🔧 Update format and lint scripts to support locally installed Pydantic and Starlette

* 🐛 Add temporary type ignores while enum schemas are merged
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

1 participant