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

Update mutation.py to serialize Enum objects into input values #1431

Merged
merged 2 commits into from Jul 26, 2023

Conversation

allen-munsch
Copy link
Contributor

@allen-munsch allen-munsch changed the title Update mutation.py to coerce Enum objects into value Update mutation.py to serialize Enum objects into input values Jul 14, 2023
@sjdemartini
Copy link
Collaborator

Thanks @allen-munsch! Would you be able to add a unit test for this? It would be great to ensure we handle this example and prevent any future regressions.

(Also, please run pre-commit formatting on the file per the failed CI job.)

@allen-munsch
Copy link
Contributor Author

@sjdemartini I added a unit test, and ran the precommit hook. Looked like it was all green locally.

Thank you for spending the time to review this.

Much appreciated!

@firaskafri firaskafri self-requested a review July 21, 2023 10:08
Copy link
Collaborator

@sjdemartini sjdemartini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating with a test! Really appreciate the contributions here 😄

graphene_django/rest_framework/tests/test_mutation.py Outdated Show resolved Hide resolved
graphene_django/rest_framework/mutation.py Outdated Show resolved Hide resolved
graphene_django/rest_framework/mutation.py Outdated Show resolved Hide resolved
@allen-munsch allen-munsch marked this pull request as draft July 24, 2023 20:54
@allen-munsch allen-munsch marked this pull request as ready for review July 24, 2023 21:14
…um objects into input values for ChoiceFields
Copy link
Collaborator

@sjdemartini sjdemartini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for the quick followup and in investigating that question. That's great you were able to make that test surface the original bug on master! And I like how simple the fix ended up being! LGTM!

graphene_django/rest_framework/mutation.py Outdated Show resolved Hide resolved
Co-authored-by: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com>
@allen-munsch
Copy link
Contributor Author

@sjdemartini No problem. It really means a lot you were working through the backlog of issues. So I wanted to make sure I didn't let this one sit around. Cheers!

@firaskafri firaskafri merged commit 5d7a04f into graphql-python:main Jul 26, 2023
13 checks passed
superlevure pushed a commit to loft-orbital/graphene-django that referenced this pull request Aug 9, 2023
…ql-python#1431)

* Fix for issue graphql-python#1385: Update mutation.py to serialize Enum objects into input values for ChoiceFields

* Update graphene_django/rest_framework/mutation.py

Co-authored-by: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com>

---------

Co-authored-by: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com>
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.

SerializerMutation not resolving Enums from serializer with ChoiceField
3 participants