-
-
Notifications
You must be signed in to change notification settings - Fork 128
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: Add support for generated enums in mutation input #497
fix: Add support for generated enums in mutation input #497
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cngai - Here's my review!
General suggestions:
- Consider adding more comprehensive tests to cover edge cases, especially where enum values might require further parsing or validation.
- Review the handling of Enums in other parts of the codebase to ensure consistency with this new approach.
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
Hey @bellini666 - would you mind giving this PR a review when you get the chance? Really appreciate it! |
11068f1
to
f624d12
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #497 +/- ##
==========================================
+ Coverage 87.97% 87.98% +0.01%
==========================================
Files 37 37
Lines 3184 3187 +3
==========================================
+ Hits 2801 2804 +3
Misses 383 383 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for taking some time to check this.
LGTM, thanks for this! :)
Thanks @bellini666 !! |
Description
If
GENERATE_ENUMS_FROM_CHOICES
is set toTrue
, mutations with enum input values will resolve the input type as an enum. When the input is parsed, it tries to save the field as an enum instead of a string value, causing Django to throw a ValidationError"Value 'ExampleEnum.VALUE' is not a valid choice."
. This PR addresses this issue by parsing the enum and returning the enum value.Types of Changes
Issues Fixed or Closed by This PR
Fix #491
Checklist