Field "errors" must not have a selection since type ExpectedErrorType has no subfields
sumitsharansatsangi opened this issue · comments
Prerequisites
- Is it a bug?
- Is it a new feature?
- Is it a a question?
- Can you reproduce the problem?
- Are you running the latest version?
- Did you check for similar issues?
- Did you perform a cursory search?
For more information, see the CONTRIBUTING guide.
Description
Errors are not JSON Serializable, When schema.graphql file is generated using following command
./manage.py graphql_schema --schema myproject.schema.schema --out schema.graphql
This command I got from the documentation of Graphene-python
https://docs.graphene-python.org/projects/django/en/latest/introspection/
The type generated for error is
scalar ExpectedErrorType
In Other words, I can say that Field "errors" must not have a selection since type ExpectedErrorType has no subfields.
.
This message can be received by graphiql (Provided by django) or Altair, when you will provide an invalid token and will try to write as follows.
mutation{
tokenAuth(email:"new_6user@email.com",password:"supersecretpassword"){
token
refreshToken
errors{
nonFieldErrors
}
}
}
Steps to Reproduce
Just implement it according to the documentation and do as I stated above.
Expected behavior
{
"data": {
"tokenAuth": {
"token": null,
"refreshToken": null,
"errors": {
"nonFieldErrors": [
{
"message": "Please, enter valid credentials.",
"code": "invalid_credentials"
}
]
}
}
}
}
Actual behavior
{
"errors": [
{
"message": "Field \"errors\" of type \"ExpectedErrorType\" must not have a sub selection.",
"locations": [
{
"line": 18,
"column": 11
}
]
}
]
}
The expected behavior are producing with
mutation{
tokenAuth(email:"new_6user@email.com",password:"supersecretpassword"){
token
refreshToken
errors
}
}
But on the front-end side Accessibility as follows is required to read the error message.
mutation{
tokenAuth(email:"new_6user@email.com",password:"supersecretpassword"){
token
refreshToken
errors{
nonFieldErrors
}
}
}
Requirements
No additional requirements except mentioned in the documents.