Class: GraphQL::StaticValidation::FragmentSpreadsArePossibleError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, type:, fragment_name:, parent:, path: nil, nodes: []) ⇒ FragmentSpreadsArePossibleError

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



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

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

Instance Attribute Details

#fragment_name ⇒ Object (readonly)

: String



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

def fragment_name
  @fragment_name
end

#parent_name ⇒ Object (readonly)

: String



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

def parent_name
  @parent_name
end

#type_name ⇒ Object (readonly)

: String



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

def type_name
  @type_name
end

Instance Method Details

#code ⇒ Object

: -> String



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

def code
  "cannotSpreadFragment"
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/fragment_spreads_are_possible_error.rb', line 24

def to_h
  extensions = {
    "code" => code,
    "typeName" => type_name,
    "fragmentName" => fragment_name,
    "parentName" => parent_name
  }

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