You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on an issue in graphql-ruby, I needed clarity on the expected behaviour of variables with default values and null value in the following example:
Query
query ($id: ID = 4) {
film(filmID: $id) {
title
}
}
Variables
{
"id": null
}
In graphql-js, null takes precedence over the default value of $id and the film resolver receives filmID: null.
The spec suggests the following algorithm for dealing with this case:
However, I got a bit confused when I read this:
It might just be me, but I got confused with "represent the lack of a value" and "if value does not exist".
I agree this can be confusing. The explicit value null is semantically different from no value being provided. I attempted to clear this up in #418 however please open new issues if there are still sections you find confusing!
While working on an issue in
graphql-ruby
, I needed clarity on the expected behaviour of variables with default values andnull
value in the following example:Query
Variables
In
graphql-js
,null
takes precedence over the default value of$id
and thefilm
resolver receivesfilmID: null
.The spec suggests the following algorithm for dealing with this case:
However, I got a bit confused when I read this:
It might just be me, but I got confused with "represent the lack of a value" and "if value does not exist".
Is "represent the lack of a value" misleading?
/cc @leebyron re: #83
/cc @rmosolgo @xuorig what we were talking about
The text was updated successfully, but these errors were encountered: