-
Couldn't load subscription status.
- Fork 2.1k
Description
I'm curious why it's not possible to validate the values of variables using the validate framework.
For example, suppose I have a very simple validator that wants to assert the value for argument name contains only ascii characters, given this schema:
type Query {
hello(name: String!): String!
}
I can implement this validator and it will work when the incoming request is this:
{
'query': '{ hello(name: "foo") }'
}
but when the request is the following, I have no way of seeing the value for the VariableNode $myName from inside the validator:
{
'query': 'query myQuery($myName: String!) { hello(name: $myName) }',
'variables': {'myName': 'foo'}
}
It looks like it comes down to this bit of the code:
https://github.com/graphql/graphql-js/blob/main/src/graphql.ts#L118-L122
Is there any reason why variableValues cannot also be passed in and made available to the validate framework?