-
Notifications
You must be signed in to change notification settings - Fork 656
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
SimpleResponseParser fails when directives reference absent booleans with default values #2703
Comments
Thanks for filing this. It looks related to #2686 |
See pull request in #2704 for a fix. Side note: for this particular exemple, the spec recommends making the Boolean as non-nullable to avoid ambiguity. # myBool should be non-optional here
query MyQuery($myBool: Boolean! = true) {
getCityByName(name: "London") {
id @include(if: $myBool)
}
} |
Interesting. Playground does the same indeed. Looking at this other issue it looks like this is more of a tooling issue. Does the query run if you hit play despite the red warning? |
Nope, same error: {
"message": "Query validation error: Invalid query: ['Variable \"$includeSubredditInPosts\" of type \"Boolean!\" is required and will not use the default value. Perhaps you meant to use type \"Boolean\".']"
} |
Interesting. Optional it is then! And certainly not worth adding a warning in the compiler if fixing the warning breaks the query 😬 |
Hmm.. I can confirm that 2.4.2 fixes this in my sample project, but I'm still seeing the error in a bigger project. Here's the full stack trace. If more info is required (like the full query), would prefer to message privately.
|
It seems to happen when passing |
Fixed with #2741 |
Version
2.4.1
Description
Given a query that has a boolean arg with a default value, e.g.
Parsing this query via
ApolloClient
works as expected. However, usingOperation::parse
fails with this exception:Sample project
Run
./gradlew run
to trigger the issue.The text was updated successfully, but these errors were encountered: