Open licx opened 4 years ago
I think this is technically an enhancement to add support for IntegerChoices and TextChoices, and I like it allot! IMHO we have always struggled to deliver an clean Enum experience and I this could deliver that.
Current challenge is that the django field gets a choice tuple and not the enum itself. Probably means we can't autoamgically link the enum when defining the ObjectType.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Are there any Updates or maybe someone has found a workaround?
When generating a schema from a model that has as a field of type
IntegerChoices
https://docs.djangoproject.com/en/3.0/ref/models/fields/#choices), the choices are not displayed in the schemaModel
class ExampleModel(models.Model): class Answer(models.IntegerChoices): NO = 0 YES = 1
Schema
class ExampleType(DjangoObjectType): class Meta: model = ExampleModel
YES
andNO
are not displayed in the enumYES
andNO
are displayed in the enumWhat is the motivation / use case for changing the behavior?
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)