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(schema): fix schema generation with multiple Enums having the same name #2226

Merged
merged 1 commit into from Jan 2, 2021

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Dec 29, 2020

Change Summary

Two Enums with the same name were overlapping because we were not using the "long name" (module name + __name__ (soon __qualname__ but that's another PR...cf #2170))
Since we were already computing the long names for both models and enums, the fix is trivial!

Related issue number

closes #1857

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)

@codecov
Copy link

codecov bot commented Dec 29, 2020

Codecov Report

Merging #2226 (d0a0142) into master (3496a47) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #2226   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         4121      4121           
  Branches       829       829           
=========================================
  Hits          4121      4121           
Impacted Files Coverage Δ
pydantic/schema.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 3496a47...d0a0142. Read the comment docs.

@samuelcolvin
Copy link
Member

looks good to me, any chance this is going to cause a breaking change with schema changing in a breaking way for some people?

@PrettyWood
Copy link
Member Author

IMO no. It doesn't change anything if there is a single name. The only impact is when there were conflicting names. So if it breaks something for someone it should highlight the issue that there were in fact multiple enums with the same name and fixing it should be trivial

@samuelcolvin samuelcolvin merged commit 13a5c7d into pydantic:master Jan 2, 2021
@samuelcolvin
Copy link
Member

thank you.

@mnixry
Copy link
Contributor

mnixry commented Jan 11, 2021

I hope this fix can be released soon

mnixry pushed a commit to mixmoe/HibiAPI that referenced this pull request Feb 26, 2021
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.

Regression in OpenAPI schema generation with multiple Enums having the same name but different enum members
3 participants