Class: GraphQL::StaticValidation::VariablesAreInputTypesError

Inherits:
StaticValidation::Error
  • Object
show all
Defined in:
lib/graphql/static_validation/rules/variables_are_input_types_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, type:, name:, path: nil, nodes: []) ⇒ VariablesAreInputTypesError

: (String message, type: String, name: String, ?path: Array[String | Integer]?, ?nodes: GraphQL::Language::Nodes::AbstractNode | Array) -> void



13
14
15
16
17
# File 'lib/graphql/static_validation/rules/variables_are_input_types_error.rb', line 13

def initialize(message, type:, name:, path: nil, nodes: [])
  super(message, path: path, nodes: nodes)
  @type_name = type #: String
  @variable_name = name #: String
end

Instance Attribute Details

#type_name ⇒ Object (readonly)

: String



8
9
10
# File 'lib/graphql/static_validation/rules/variables_are_input_types_error.rb', line 8

def type_name
  @type_name
end

#variable_name ⇒ Object (readonly)

: String



10
11
12
# File 'lib/graphql/static_validation/rules/variables_are_input_types_error.rb', line 10

def variable_name
  @variable_name
end

Instance Method Details

#code ⇒ Object

: -> String



34
35
36
# File 'lib/graphql/static_validation/rules/variables_are_input_types_error.rb', line 34

def code
  "variableRequiresValidType"
end

#to_h ⇒ Object

A hash representation of this Message : -> Hash[String, untyped]



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/graphql/static_validation/rules/variables_are_input_types_error.rb', line 21

def to_h
  extensions = {
    "code" => code,
    "typeName" => type_name,
    "variableName" => variable_name
  }

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