Class: GraphQL::StaticValidation::VariableNamesAreUniqueError

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

Instance Attribute Summary collapse

Attributes inherited from Error

#message, #path

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of VariableNamesAreUniqueError



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

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

Instance Attribute Details

#variable_nameObject (readonly)

Returns the value of attribute variable_name



5
6
7
# File 'lib/graphql/static_validation/rules/variable_names_are_unique_error.rb', line 5

def variable_name
  @variable_name
end

Instance Method Details

#codeObject



24
25
26
# File 'lib/graphql/static_validation/rules/variable_names_are_unique_error.rb', line 24

def code
  "variableNotUnique"
end

#to_hObject

A hash representation of this Message



13
14
15
16
17
18
19
20
21
22
# File 'lib/graphql/static_validation/rules/variable_names_are_unique_error.rb', line 13

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

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