diff --git a/lib/query-validation-visitor.js b/lib/query-validation-visitor.js index 22f8e4b..5dcb736 100644 --- a/lib/query-validation-visitor.js +++ b/lib/query-validation-visitor.js @@ -54,12 +54,14 @@ module.exports = class QueryValidationVisitor { } // Get variable values from variables that are passed from options, merged with default values defined in the operation - this.variableValues = getVariableValues( + const {coerced, errors} = getVariableValues( this.context.getSchema(), // We have to create a new array here because input argument is not readonly in graphql ~14.6.0 operation.variableDefinitions ? [...operation.variableDefinitions] : [], this.options.variables ?? {} - ).coerced + ) + if (errors?.length > 0) throw errors + this.variableValues = coerced // prepare basic this.currentTypeInfo based on the operation let typeDef