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

Add Enum generation for Django choice fields #144

Closed
jaydenwindle opened this issue Sep 7, 2019 · 3 comments
Closed

Add Enum generation for Django choice fields #144

jaydenwindle opened this issue Sep 7, 2019 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jaydenwindle
Copy link
Member

It would be great to support generating enum return types for Django CharFields where choices are defined. Currently strawberry resolves all CharField values to a String type.

We'll need to make sure that we don't define duplicate enum types or use names that would clash with other types in the schema.

See graphql-python/graphene-django#185 (comment) for a discussion about auto-generated choice enum types in Graphene.

@jaydenwindle jaydenwindle added the enhancement New feature or request label Sep 7, 2019
@agritheory
Copy link

Does this have to be Django specific? A choice-to-enum pattern/utility would be helpful regardless of framework or database.

@patrick91
Copy link
Member

@agritheory we do support python enums already! See here: https://github.com/strawberry-graphql/strawberry/blob/master/tests/test_enum.py

I've asked a friend to work on the design for the new website+docs so hopefully we'll start working on documentation soon :)

@patrick91 patrick91 added help wanted Extra attention is needed Hacktoberfest labels Sep 24, 2019
@patrick91
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants