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

Unexpected name "null" when null is provided to an arguments #47

Closed
alansmithnbs opened this issue Feb 2, 2017 · 5 comments
Closed
Milestone

Comments

@alansmithnbs
Copy link

I have a use case where i'm trying to get root nodes of a tree represented in a relational database - i've used GraphQL to wrap around Sequelize.

To achieved this, I want to pass "null" as an argument to my GraphQL server as part of the query - according to the GraphQL spec null parameter values are allowed (http://facebook.github.io/graphql/#sec-Null-Value). However, graphql-tag seems to throw the following error when parsing the query:

Syntax Error GraphQL (2:25) Unexpected Name "null"
1: query {
2: taxon(parentId: null) {
^
3: id,

I have a workaround for this issue - but just wondered whether it was intended functionality?

Thanks,

Alan

@okbel
Copy link

okbel commented Feb 15, 2017

I'm facing the same issue too. Could you find a work arround for it? 😰 @alansmithribae

@jnwng
Copy link
Contributor

jnwng commented Feb 16, 2017

@alansmithribae @okbel sorry for taking so long to address this issue - i dug deeper into this and found that passing null as a field argument was added in [email protected], specifically in #544.

we updated graphql-tag with [email protected] in [email protected] - could you double-check that you both have the latest version of graphql-tag?

@alansmithnbs
Copy link
Author

Thanks @jnwng for getting back to me. I double checked the version and I am using graphql-tag v1.2.4. I'm using it with angular 2 by the way - not sure if this makes a difference.
@okbel my workaround was very primitive - my database id's are positive numbers. In my query, I pass -1 instead of null. Server-side, I assume that parentId: -1 means 'select ... from ... where parentId is null'. But I am only prototyping, NOT writing production code!

@jnwng
Copy link
Contributor

jnwng commented Feb 18, 2017

@alansmithribae ah, you're correct - we used to bundle the graphql parser in the build process, so we're probably bundling an older version of graphql in 1.2.4. luckily, @abhiaiyer91 already addressed this by making sure we depend on the graphql package here, we just need to cut a new release. i'll prep the release and it'll probably be out in 1.3.0 (i'll loop back when its live)

@jnwng jnwng mentioned this issue Feb 23, 2017
@jnwng jnwng added this to the v1.3 milestone Feb 23, 2017
@jnwng
Copy link
Contributor

jnwng commented Feb 28, 2017

this should be resolved as part of [email protected]

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

3 participants