Closed alexander-myltsev closed 6 years ago
Thanks for reporting this, I will investigate.
I don't see you doing anything wrong, so if the issue is valid, I suspect it's a bug in the code.
Produces query with errors (no commas between query parameters):
This part might be intentional. My intention was to produce a minified query. When I tested against GitHub's GraphQL server, it accepted comma-less query parameters without issues.
See the following test-case:
Can you tell me what you're basing the statement that omitting commas is an error on? Is it because it looks wrong, or is it failing to work? If the latter, how can I reproduce it?
Of course, our best bet is to look into the GraphQL spec to see whether omitting commas is considered valid or not.
http://facebook.github.io/graphql/October2016/#sec-Insignificant-Commas and http://facebook.github.io/graphql/October2016/#sec-List-Value seem to suggest that omitting commas is indeed a valid thing to do:
Similar to white space and line terminators, commas (,) are used to improve the legibility of source text and separate lexical tokens but are otherwise syntactically and semantically insignificant within GraphQL query documents.
Commas are optional throughout GraphQL so trailing commas are allowed and repeated commas do not represent missing values.
It produces query with errors too (variable type should be
$someids:[ID!]!
with bang in the end):query($someids:[ID!]){nameStringsByUuid(uuids:[$someids]){inputId}}
That part seems to be a legitimate issue. Basically, I hadn't run into that situation yet, so the code that handles it was left incomplete.
@alexander-myltsev, please see PR #7, it resolves this issue.
@shurcooL works for me now.
Thanks for testing, and for reporting this issue! I'll merge the PR now.
The query and variables as follows:
Produces query with errors (no commas between query parameters):
On the other hand, when I'm using queries as follows:
It produces query with errors too (variable type should be
$someids:[ID!]!
with bang in the end):Is it a bug, or am I doing something wrong?