Class: GraphQL::StaticValidation::TypeStack::FieldStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/static_validation/type_stack.rb

Instance Method Summary collapse

Instance Method Details

#pop(stack, node) ⇒ Object



103
104
105
106
# File 'lib/graphql/static_validation/type_stack.rb', line 103

def pop(stack, node)
  stack.field_definitions.pop
  stack.object_types.pop
end

#push(stack, node) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/graphql/static_validation/type_stack.rb', line 89

def push(stack, node)
  parent_type = stack.object_types.last
  parent_type = parent_type.unwrap

  field_definition = stack.schema.get_field(parent_type, node.name)
  stack.field_definitions.push(field_definition)
  if !field_definition.nil?
    next_object_type = field_definition.type
    stack.object_types.push(next_object_type)
  else
    stack.object_types.push(nil)
  end
end