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
Uniform parsing of queries with short-hand syntax with regular queries #1094
Uniform parsing of queries with short-hand syntax with regular queries #1094
Conversation
@angly-cat 😮 Wow, you solved the mystery of
I think You can change line 285 to:
As a bonus it should fix broken tests 😉 |
d0c75b1
to
bfef7b3
Compare
by making the parser return the same result as with short-hand syntax queries
bfef7b3
to
ceff6f7
Compare
Thanks for your kind words.
I agree. However, all of my attempts to change output of short-hand syntax query parsing caused a test to fail. (OMG it was quite hard to make tests work on Windows) According to these |
@angly-cat Great 👍 |
@IvanGoncharov the idea about adding a test was great, so, I added it. |
@angly-cat Great 👍 |
Nice work! I think since other array-parsing operations default to empty arrays instead of null, that this should follow that convention, so I made some updates. |
Agreed. Thanks, @leebyron. |
To date, parsing queries with short-hand syntax returns different results from parsing regular queries.
parse('query{a{b}}')
returnsHowever,
parse('{a{b}}')
returnsThis shouldn't be the case. This PR made queries with short-hand syntax to be parsed as regular.
This inconsistency indirectly causes this bug to happen in GraphiQL. Despite that issue being closed, using GraphiQL without
express-graphql
still makes that bug to happen (withnull
value, actually, but this doesn't change much).Closes #729.