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: generate a valid name in schema for Enum classes #2582

Merged
merged 6 commits into from May 9, 2021

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Mar 25, 2021

Change Summary

A regression has been introduced in 1.8 since we now use display_as_type for the name of the model and display_as_type handles Enum weirdly.
IMO the special case for Enum is not useful anymore since they are properly handled now both in code and in schema but let's see what the CI says!

Related issue number

closes #2575

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)

@PrettyWood PrettyWood added the bug V1 Bug related to Pydantic V1.X label Mar 25, 2021
@codecov
Copy link

codecov bot commented Mar 25, 2021

Codecov Report

Merging #2582 (e4e1405) into master (7b7e705) will not change coverage.
The diff coverage is n/a.

❗ Current head e4e1405 differs from pull request most recent head 50abaac. Consider uploading reports for the commit 50abaac to get more accurate results

@@            Coverage Diff            @@
##            master     #2582   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         5109      5102    -7     
  Branches      1050      1047    -3     
=========================================
- Hits          5109      5102    -7     
Impacted Files Coverage Δ
pydantic/typing.py 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 68784f6...50abaac. Read the comment docs.

@PrettyWood PrettyWood added this to the v1.8.2 milestone Mar 30, 2021
@samuelcolvin samuelcolvin merged commit 0b3c563 into pydantic:master May 9, 2021
samuelcolvin added a commit that referenced this pull request May 11, 2021
* fix: generate a valid name in schema for `Enum` classes

* test: add schema with generic enum

* (erase me): just to check fastapi tests

* Revert "(erase me): just to check fastapi tests"

This reverts commit f334c4b.

* fix linting 😴

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema generation with GenericModel and multiple enums is broken since 1.8.0
2 participants