class GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError

Constants

VIOLATIONS

Attributes

type_name[R]
variable_name[R]
violation[R]

Public Class Methods

new(message, path: nil, nodes: [], name:, type: nil, error_type:) click to toggle source
Calls superclass method GraphQL::StaticValidation::Error::new
# File lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb, line 14
def initialize(message, path: nil, nodes: [], name:, type: nil, error_type:)
  super(message, path: path, nodes: nodes)
  @variable_name = name
  @type_name = type
  raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type)
  @violation = error_type
end

Public Instance Methods

code() click to toggle source
# File lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb, line 34
def code
  @violation
end
to_h() click to toggle source

A hash representation of this Message

Calls superclass method GraphQL::StaticValidation::Error#to_h
# File lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb, line 23
def to_h
  extensions = {
    "code" => code,
    "variableName" => variable_name
  }.tap { |h| h["typeName"] = type_name unless type_name.nil? }

  super.merge({
    "extensions" => extensions
  })
end