Class: GraphQL::StaticValidation::TypeStack::ArgumentStrategy
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::TypeStack::ArgumentStrategy
- Defined in:
- lib/graphql/static_validation/type_stack.rb
Instance Method Summary collapse
- #pop(stack, node) ⇒ Object
-
#push(stack, node) ⇒ Object
Push ‘argument_defn` onto the stack.
Instance Method Details
#pop(stack, node) ⇒ Object
162 163 164 165 |
# File 'lib/graphql/static_validation/type_stack.rb', line 162 def pop(stack, node) stack.argument_definitions.pop stack.path.pop end |
#push(stack, node) ⇒ Object
Push ‘argument_defn` onto the stack. It’s possible that ‘argument_defn` will be nil. Push it anyways so `pop` has something to pop.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/graphql/static_validation/type_stack.rb', line 143 def push(stack, node) if stack.argument_definitions.last arg_type = stack.argument_definitions.last.type.unwrap if arg_type.kind.input_object? argument_defn = arg_type.input_fields[node.name] else argument_defn = nil end elsif stack.directive_definitions.last argument_defn = stack.directive_definitions.last.arguments[node.name] elsif stack.field_definitions.last argument_defn = stack.field_definitions.last.arguments[node.name] else argument_defn = nil end stack.argument_definitions.push(argument_defn) stack.path.push(node.name) end |