Module: GraphQL::StaticValidation::TypeStack::FieldStrategy

Defined in:
lib/graphql/static_validation/type_stack.rb

Class Method Summary collapse

Class Method Details

.pop(stack, node) ⇒ Object



123
124
125
126
127
# File 'lib/graphql/static_validation/type_stack.rb', line 123

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

.push(stack, node) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/graphql/static_validation/type_stack.rb', line 108

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
  stack.path.push(node.alias || node.name)
end