Skip to content
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

Confusion around variables with default values and null value #257

Closed
cjoudrey opened this issue Jan 5, 2017 · 1 comment
Closed

Confusion around variables with default values and null value #257

cjoudrey opened this issue Jan 5, 2017 · 1 comment

Comments

@cjoudrey
Copy link

cjoudrey commented Jan 5, 2017

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:

screen shot 2017-01-05 at 5 01 15 pm

However, I got a bit confused when I read this:

screen shot 2017-01-05 at 5 02 23 pm

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

@leebyron
Copy link
Collaborator

leebyron commented May 1, 2018

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!

@leebyron leebyron closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants