-
Notifications
You must be signed in to change notification settings - Fork 322
Description
(I spot-checked docs and other issues and couldn't find anything about this; apologies if I missed something)
Affects spring-graphql:1.4.1
.
Consider a graphqlClient.documentName("...").variable(/*...*/).executeSync().toEntity(/*...*/)
sequence. It's possible that the values supplied by variable
calls will mismatch the set of variables defined for the query in the documentName
, like providing a value of the wrong type (eg value null for a variable defined as non-null). Similarly, the query itself might be defined with an unused variable.
Those cases could be detected on the client-side, but, are currently sent over the network to the server anyway. This can yield exceptions like this:
org.springframework.graphql.client.FieldAccessException: Invalid field '', errors: [{message=Validation error (UnusedVariable) : Unused variable 'junk'}]
at org.springframework.graphql.client.DefaultClientResponseField.toEntity(DefaultClientResponseField.java:106) ~[spring-graphql-1.4.1.jar:1.4.1]
It would be nice to have an option to run client-side variable validation before sending a query, to avoid consuming unnecessary network/server resources.