graphql-python / graphql-python/graphene-django

Wrong error message for nested serializer in mutation

Open
#713 3 comments 1 reaction 0 assignees View on GitHub
🐛bug
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

I have serializer mutation

```
class EmployeeSaveMutation(SerializerMutation):
class Meta:
serializer_class = EmployeeSerializer

class EmployeeSerializer(serializers.ModelSerializer):
user = UserSerializer()

class Meta:
model = Employee
fields = '__all__'

class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = '__all__'

def validate(self, attrs):
raise serilizers.ValidationError('raise UserSerializer validate')
```

The response is:

```
erorrs = [
{ field: "user", messages: ["non_field_errors"] }
]
```

I need response something like:
```
{ field: "user.non_field_errors", messages: ["raise UserSerializer validate"] }
```

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.