Class: GraphQL::StaticValidation::RequiredArgumentsArePresentError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

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



15
16
17
18
19
20
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 15

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

Instance Attribute Details

#arguments ⇒ Object (readonly)

: String



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

def arguments
  @arguments
end

#class_name ⇒ Object (readonly)

: String



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

def class_name
  @class_name
end

#name ⇒ Object (readonly)

: String



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

def name
  @name
end

Instance Method Details

#code ⇒ Object

: -> String



38
39
40
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 38

def code
  "missingRequiredArguments"
end

#to_h ⇒ Object

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



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/graphql/static_validation/rules/required_arguments_are_present_error.rb', line 24

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

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