@Override public void checkVariable(VariableReference variableReference) { VariableDefinition variableDefinition = variableDefinitionMap.get(variableReference.getName()); if (variableDefinition == null) return; GraphQLType variableType = TypeFromAST.getTypeFromAST( getValidationContext().getSchema(), variableDefinition.getType()); if (variableType == null) return; GraphQLInputType inputType = getValidationContext().getInputType(); if (!variablesTypesMatcher.doesVariableTypesMatch( variableType, variableDefinition.getDefaultValue(), inputType)) { String message = "Variable type doesn't match"; addError( new ValidationError( ValidationErrorType.VariableTypeMismatch, variableReference.getSourceLocation(), message)); } }
@Override public void checkVariableDefinition(VariableDefinition variableDefinition) { variableDefinitionMap.put(variableDefinition.getName(), variableDefinition); }