graphql-python / graphql-python/graphene-django

Nullable ArrayField converted to not nullable GraphQL Type

Open
#1,120 1 comment 0 reactions 0 assignees View on GitHub
🐛bug
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

* **What is the current behavior?**
Аfter #545 for `django.db.models.ArrayField` with `null=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:
```python
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:

![image](https://user-images.githubusercontent.com/13115270/108111653-0a065000-70a6-11eb-9a8b-74dc2c099128.png)

Type is defined simply through Meta:
```python
class SpecificationType(DjangoObjectType):

class Meta:
model = Specification
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.