Method: GraphQL::StaticValidation::VariablesAreUsedAndDefined#on_operation_definition

Defined in:
lib/graphql/static_validation/rules/variables_are_used_and_defined.rb

#on_operation_definition(node, parent) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/graphql/static_validation/rules/variables_are_used_and_defined.rb', line 33

def on_operation_definition(node, parent)
  # initialize the hash of vars for this context:
  @variable_usages_for_context[node]
  @variable_context_stack.push(node)
  # mark variables as defined:
  var_hash = @variable_usages_for_context[node]
  node.variables.each { |var|
    var_usage = var_hash[var.name]
    var_usage.declared_by = node
    var_usage.path = context.path
  }
  super
  @variable_context_stack.pop
end