Class: GraphQL::StaticValidation::RequiredArgumentsArePresentError

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

Instance Attribute Summary collapse

Attributes inherited from Error

#message, #path

Instance Method Summary collapse

Constructor Details

#initialize(message, path: nil, nodes: [], class_name:, name:, arguments:) ⇒ RequiredArgumentsArePresentError

Returns a new instance of RequiredArgumentsArePresentError.



9
10
11
12
13
14
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 9

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

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



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

def arguments
  @arguments
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



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

def class_name
  @class_name
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 6

def name
  @name
end

Instance Method Details

#codeObject



30
31
32
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 30

def code
  "missingRequiredArguments"
end

#to_hObject

A hash representation of this Message



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 17

def to_h
  extensions = {
    "code" => code,
    "className" => class_name,
    "name" => name,
    "arguments" => arguments
  }

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