class GraphQL::Query::VariableValidationError
Attributes
Public Class Methods
# File lib/graphql/query/variable_validation_error.rb, line 8 def initialize(variable_ast, type, value, validation_result, msg: nil) @value = value @validation_result = validation_result msg ||= "Variable $#{variable_ast.name} of type #{type.to_type_signature} was provided invalid value" if !problem_fields.empty? msg += " for #{problem_fields.join(", ")}" end super(msg) self.ast_node = variable_ast end
Calls superclass method
GraphQL::ExecutionError::new
Public Instance Methods
Source
# File lib/graphql/query/variable_validation_error.rb, line 22 def to_h # It is possible there are other extension items in this error, so handle # a one level deep merge explicitly. However beyond that only show the # latest value and problems. super.merge({ "extensions" => { "value" => value_for_extensions, "problems" => validation_result.problems }}) do |key, oldValue, newValue| if oldValue.respond_to?(:merge) oldValue.merge(newValue) else newValue end end end
Calls superclass method
GraphQL::ExecutionError#to_h