Method: GraphQL::StaticValidation::BaseVisitor::ContextMethods#on_argument

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

#on_argument(node, parent) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/graphql/static_validation/base_visitor.rb', line 103

def on_argument(node, parent)
  argument_defn = if (arg = @argument_definitions.last)
    arg_type = arg.type.unwrap
    if arg_type.kind.input_object?
      @types.argument(arg_type, node.name)
    else
      nil
    end
  elsif (directive_defn = @directive_definitions.last)
    @types.argument(directive_defn, node.name)
  elsif (field_defn = @field_definitions.last)
    @types.argument(field_defn, node.name)
  else
    nil
  end

  @argument_definitions.push(argument_defn)
  @path.push(node.name)
  super
  @argument_definitions.pop
  @path.pop
end