-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Incorrect response when errors occurred #2470
Comments
* Fix issue #2470 * go generate ./... * regenerate examples Signed-off-by: Steve Coffman <steve@khanacademy.org> Signed-off-by: Steve Coffman <steve@khanacademy.org> Co-authored-by: Roman A. Grigorovich <ragrigorov@mts.ru> Co-authored-by: Steve Coffman <steve@khanacademy.org>
This is a major behavior change, breaking a lot of existing code. |
@atzedus are you sure that behaviour that you described in your issue is correct for the schema you listed? I rolled back gqlgen to version extend type Query {
Kids: [ID!]
Martials: [ID!]
} Query: query {
Kids
Martials
} Returned {
"errors": [
{
"message": "some error",
"path": [
"Kids"
],
}
],
"data": {
"Kids": null,
"Martials": ["1", "2", "3", "4"]
}
} To receive result as claimed in your issue, Kids list would have to be Non-Null type as follows for extend type Query {
Kids: [ID!]
KidsNN: [ID!]!
Martials: [ID!]
} Query: query {
Kids
Martials
KidsNN
} Now with same {
"errors": [
{
"message": "some error",
"path": [
"Kids"
],
},
{
"message": "some error",
"path": [
"KidsNN"
],
}
],
"data": null
} And above behaviour is correct according to Graphql specification:
According to this spec previous behaviour was correct:
Based on the above points I believe that #2471 should be reverted. Right now it is also causing issues in more complex scenarios, where type wrapped in a list is a structure. When one of its fields resolves to |
…rred (99designs#2471)" This reverts commit 5cb6e3e.
What happened?
When querying multiple fields at once and at least one of it returns error, then whole response become null with no any description where it
null
is.What did you expect?
List of errors and
data
with fields name queried.Minimal graphql.schema and models to reproduce
Schema:
Query:
Result:
What expected?:
versions
go run github.com/99designs/gqlgen v.0.17.22
?go 1.19
?P.S. I will send pull request to fix this soon.
The text was updated successfully, but these errors were encountered: