graphene-django
graphene-django copied to clipboard
Nullable ArrayField converted to not nullable GraphQL Type
-
What is the current behavior? Аfter #545 for
django.db.models.ArrayField
withnull=True
we getting not nullable GraphQL Type. -
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example). All same as in #536, but define ArrayField as nullable in model:
class Example(models.Model):
simple_array = ArrayField(models.CharField(max_length=255), blank=True, null=True)
-
What is the expected behavior? We can have null values for this field.
-
What is the motivation / use case for changing the behavior?
-
Please tell us about your environment:
- Version: graphene-django 2.15
- Platform: Django 3.1.6
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)
We used older version before and all was fine (that's why I blame #545)
My case:
Type is defined simply through Meta:
class SpecificationType(DjangoObjectType):
class Meta:
model = Specification
A little thought brought a workaround (so not sure, if it is still a bug). If you also provide null=True
for base_field
, all works fine:
class Example(models.Model):
simple_array = ArrayField(models.CharField(max_length=255, blank=True, null=True), blank=True, null=True)