Class: Yogurt::QueryContainer::InterfacesAndUnionsHaveTypename::Error

Inherits:
GraphQL::StaticValidation::Error
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/yogurt/query_container/interfaces_and_unions_have_typename.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Error.



28
29
30
31
32
# File 'lib/yogurt/query_container/interfaces_and_unions_have_typename.rb', line 28

def initialize(message, node_name:, path: nil, nodes: [], type: nil)
  super(message, path: path, nodes: nodes)
  @node_name = T.let(node_name, String)
  @type_name = T.let(type, T.nilable(String))
end

Instance Attribute Details

#node_nameObject (readonly)

Returns the value of attribute node_name.



17
18
19
# File 'lib/yogurt/query_container/interfaces_and_unions_have_typename.rb', line 17

def node_name
  @node_name
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



14
15
16
# File 'lib/yogurt/query_container/interfaces_and_unions_have_typename.rb', line 14

def type_name
  @type_name
end

Instance Method Details

#codeObject



47
48
49
# File 'lib/yogurt/query_container/interfaces_and_unions_have_typename.rb', line 47

def code
  "interfaceOrUnionMissingTypename"
end

#to_hObject



36
37
38
39
40
41
42
43
44
# File 'lib/yogurt/query_container/interfaces_and_unions_have_typename.rb', line 36

def to_h
  extensions = {
    "code" => code,
    "nodeName" => @node_name
  }

  extensions['typeName'] = @type_name if @type_name
  super.merge({ "extensions" => extensions })
end