Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Making enum override hash generation match when blank or None values included. #833

Merged
merged 1 commit into from
Dec 10, 2022

Conversation

trumpet2012
Copy link
Contributor

Fixes #832.

This updates the logic in load_enum_name_overrides so that it creates the hash value after removing None and blank string values to match the same hashing behavior found in postprocess_schema_enums.

Without this the overrides aren't correctly applied since the hashes don't match.

@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Base: 98.68% // Head: 98.70% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (43a8d61) compared to base (edab4be).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #833      +/-   ##
==========================================
+ Coverage   98.68%   98.70%   +0.02%     
==========================================
  Files          66       66              
  Lines        7617     7659      +42     
==========================================
+ Hits         7517     7560      +43     
+ Misses        100       99       -1     
Impacted Files Coverage Δ
drf_spectacular/plumbing.py 97.34% <100.00%> (+0.13%) ⬆️
tests/test_postprocessing.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

…ash to match the hash generation logic in the enum post processor hook
@trumpet2012
Copy link
Contributor Author

Just pushed a fix for a Django compatibility issue in the new tests.

@tfranzel
Copy link
Owner

thx @trumpet2012. Sry this took so long. Excellent PR! I just simplified the the hashable_values line which was needlessly complicated prior to your change.

tfranzel added a commit that referenced this pull request Dec 10, 2022
@tfranzel tfranzel merged commit 43a8d61 into tfranzel:master Dec 10, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENUM_NAME_OVERRIDES not applying if choice values include a blank string as an option.
2 participants