Fields named "null" are incorrectly parsed as invalid
See original GitHub issueVersion 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"
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:
- Created 4 years ago
- Reactions:3
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in the upcoming 2.4.0.
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.