Class: GraphQL::StaticValidation::FragmentsAreOnCompositeTypesError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

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



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

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

Instance Attribute Details

#type_name ⇒ Object (readonly)

: String



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

def type_name
  @type_name
end

Instance Method Details

#code ⇒ Object

: -> String



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

def code
  "fragmentOnNonCompositeType"
end

#to_h ⇒ Object

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



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

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

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