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 collision with same choices & varying labels #790 #1104 #1113

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

tfranzel
Copy link
Owner

No description provided.

Copy link

codecov bot commented Nov 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (82c00f8) 98.61% compared to head (dc73fc0) 98.62%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1113   +/-   ##
=======================================
  Coverage   98.61%   98.62%           
=======================================
  Files          70       70           
  Lines        8506     8555   +49     
=======================================
+ Hits         8388     8437   +49     
  Misses        118      118           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tfranzel tfranzel force-pushed the enum_mapping_fix branch 2 times, most recently from 908160c to 7cc36f0 Compare November 25, 2023 11:19
@tfranzel tfranzel merged commit e022b4e into master Nov 28, 2023
64 checks passed
@tfranzel tfranzel deleted the enum_mapping_fix branch November 29, 2023 14:38
@HansAarneLiblik
Copy link

@tfranzel After upgrading, our schema is now full of these hashes. Shouldn't they be removed after schema is generated ?

image

@HansAarneLiblik
Copy link

Aha, we have overridden POSTPROCESSING_HOOKS setting. We also need to include your default!

@tfranzel
Copy link
Owner Author

I assume you are not using the default hook?

def postprocess_schema_enums(result, generator, **kwargs):

please add

def postprocess_schema_enum_id_removal(result, generator, **kwargs):

to you postprocessing hooks (at the end).

The new hook is already part of postprocess_schema_enums, but if you change it you need to add the new hook manually.

ghazi-git added a commit to ghazi-git/drf-standardized-errors that referenced this pull request Jan 1, 2024
…VERRIDES` under `SPECTACULAR_SETTINGS` to ensure compatibility with drf-spectacular 0.27.0 and newer versions.

That avoids the warnings about enum name collisions after drf-spectacular started differentiating between the 2 in tfranzel/drf-spectacular#1113

fixes #53
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