graphql-python / graphql-python/graphene-django
How to perform partial update using mutation?
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to perform partial update using graphene. I'm following [docs for serializers](https://docs.graphene-python.org/projects/django/en/latest/mutations/#create-update-operations), but I can't run the mutation, because of required fields. Here's an example.
**Serializer**
```python
class StudySerializer(serializers.ModelSerializer):
class Meta:
model = Study
fields = '__all__'
# required for accepting "id" in mutation's arguments
# see https://github.com/graphql-python/graphene-django/issues/906#issuecomment-602078174
extra_kwargs = {'id': {'read_only': False, 'required': False}}
```
**Mutation**
```python
class UpdateStudy(SerializerMutation):
class Meta:
serializer_class = StudySerializer
model_operations = ['update']
```
GraphQL is complaining about missing fields in mutation, but they should be optional

Is there any workaround for this?
Contributor guide
Assessment
This issue has not been assessed yet.