You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for taking the time to report this, but I'm not sure this is a bug, even if it is a change in behavior from the past.
The GraphQL documentation gives these examples showing omitting parenthesis for queries when there are no arguments:
type Query {
books: [Book]
authors: [Author]
}
And the spec states that if you try to add empty parenthesis like:
queryGetSomething() { # <-- empty arguments list hereuser() { # <-- empty argument list herename
}
}
There should be a validation error in Line 1 and Line 2 each because in GraphQL, Arguments must contain at least one Argument. In GraphQL spec, the notation [list] means one or more -- see spec definition
Note that the entire "Arguments" portion is optional in both contexts, therefore query GetSomething { ... } is allowed and so is user { ... }, but if the braces () are present they must contain something.
graphql-js reports errors on both cases correctly.
This parser used to allow empty parenthesis, but we are trying to maintain spec compliance. The change was made here: #293
What happened?
I have the following in my definition file under Queries:
gqlparse bombs out with:
expected at least one definition, found )
What did you expect?
I think it is allowed to have a query without paratemers. I expect gqlparse to accept this line.
Minimal graphql.schema and models to reproduce
versions
The text was updated successfully, but these errors were encountered: