question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fields named "null" are incorrectly parsed as invalid

See original GitHub issue

Version and Environment Details

Operation system:

Ubuntu 18.04.2 LTS

IDE name and version:

PhpStorm 2019.1 Build #PS-191.6183.95, built on March 28, 2019

Plugin version:

JS GraphQL (2.0.0)

Expected Behaviour

The following schema should be parsed without error:

input Foo {
  null: String
}

As per spec the only restriction on field names is the regexp /[_A-Za-z][_0-9A-Za-z]*/ and thus “null”, while probably not very common, is a valid field name.

Actual Behaviour

The following error is shown and it will break (in a non-obvious way) all other types depending on this one:

Invalid Syntax : Unexpected token: "null"

image

Steps to Reproduce / Link to Repo with Reproduction and Instructions

Copy/paste the schema above in probably any .graphql file.

I suspect the root of this issue actually is in another project. If you can confirm this, I’ll gladly open a new issue where it would be the most appropriate.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
jimkyndemeyercommented, Mar 13, 2020

Fixed in the upcoming 2.4.0.

1reaction
jimkyndemeyercommented, Jan 22, 2020

Thanks for the heads up.

There’s a number of breaking API changes when upgrading from graphql-java 12 to 14, some of which produce compile errors in the plugin. These also need to be addressed.

I can’t say when a fix will land, but I do see this as one of the next issues that need to be fixed.

Best regards, Jim.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The example parse incorrect, if the field type is object ... - GitHub
IF the field type is object . example parse incorrectly. The error message is: Example should have either a value or externalValue field....
Read more >
Can't validate date field in json - Stack Overflow
The return value is: A Date parsed from the string. In case of error, returns null. So an exception is not expected for...
Read more >
Flow Parse JSON Null Error Fix - April Dunnam
The Error. When testing your Flow with your HTTP and Parse JSON Actions you might get an error that says: “Invalid type. ·...
Read more >
Parse JSON error - "message": "Invalid type. Expected Object ...
I have the HTTP working but I get errors in the Parse JSON. I got a null error and used April Dunnam's solution...
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found