We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
According to the end of 7.1.2 Errors, non-standard fields should be put under extensions in case of error.
extensions
Currently when returning an error, this extension behaves like the counter example and sets code, fields, short_message and vars directly:
code
fields
short_message
vars
{ "data": null, "errors": [ { "code": "forbidden", "fields": [], "locations": [{ "column": 3, "line": 2 }], "message": "forbidden", "path": ["some_path"], "short_message": "forbidden", "vars": {} } ] }
To Reproduce Setup a GraphQL server and perform a request which triggers an authentication failure.
Expected behavior The non-standard fields should be put under an extensions key:
{ "data": null, "errors": [ { "locations": [{ "column": 3, "line": 2 }], "message": "forbidden", "path": ["some_path"], "extensions": { "code": "forbidden", "fields": [], "short_message": "forbidden", "vars": {} } } ] }
To not break backward compatibility while providing support for spec-compliant clients, the fields could be duplicated in the meantime:
{ "data": null, "errors": [ { "locations": [{ "column": 3, "line": 2 }], "message": "forbidden", "path": ["some_path"], "code": "forbidden", "fields": [], "short_message": "forbidden", "vars": {} "extensions": { "code": "forbidden", "fields": [], "short_message": "forbidden", "vars": {} } } ] }
Additional context I am querying the GraphQL server with a Go client which discards non-standard keys not put under extensions: https://pkg.go.dev/github.com/vektah/gqlparser/[email protected]/gqlerror#Error
The text was updated successfully, but these errors were encountered:
Thanks for the report! There is no harm in adding it to both places. I won't have time to do this in the near future, but PRs welcome 🙇
Sorry, something went wrong.
No branches or pull requests
Describe the bug
According to the end of 7.1.2 Errors, non-standard fields should be put under
extensions
in case of error.Currently when returning an error, this extension behaves like the counter example and sets
code
,fields
,short_message
andvars
directly:To Reproduce
Setup a GraphQL server and perform a request which triggers an authentication failure.
Expected behavior
The non-standard fields should be put under an
extensions
key:To not break backward compatibility while providing support for spec-compliant clients, the fields could be duplicated in the meantime:
Additional context
I am querying the GraphQL server with a Go client which discards non-standard keys not put under
extensions
: https://pkg.go.dev/github.com/vektah/gqlparser/[email protected]/gqlerror#ErrorThe text was updated successfully, but these errors were encountered: