class GraphQL::StaticValidation::VariablesAreUsedAndDefinedError

Constants

VIOLATIONS

Attributes

variable_name[R]
violation[R]

Public Class Methods

new(message, path: nil, nodes: [], name:, error_type:) click to toggle source
Calls superclass method GraphQL::StaticValidation::Error::new
# File lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb, line 13
def initialize(message, path: nil, nodes: [], name:, error_type:)
  super(message, path: path, nodes: nodes)
  @variable_name = name
  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/variables_are_used_and_defined_error.rb, line 32
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/variables_are_used_and_defined_error.rb, line 21
def to_h
  extensions = {
    "code" => code,
    "variableName" => variable_name
  }

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