class GraphQL::StaticValidation::TypeStack
-
Ride along with `GraphQL::Language::Visitor`
-
Track type info, expose it to validators
Constants
- PUSH_STRATEGIES
- TYPE_INFERRENCE_ROOTS
These are jumping-off points for infering types down the tree
Attributes
@return [Array<GraphQL::Node::Argument>] arguments which have been entered
Directives are pushed on, then popped off while traversing the tree @return [Array<GraphQL::Node::Directive>] directives which have been entered
When it enters a field, it's pushed on this stack (useful for nested fields, args). When it exits, it's popped off. @return [Array<GraphQL::Field>] fields which have been entered
When it enters an object (starting with query or mutation root), it's pushed on this stack. When it exits, it's popped off. @return [Array<GraphQL::ObjectType, GraphQL::Union, GraphQL::Interface>]
@return [Array<String>] fields which have been entered (by their AST name)
@return [GraphQL::Schema] the schema whose types are present in this document
Public Class Methods
@param schema [GraphQL::Schema] the schema whose types to use when climbing this document @param visitor [GraphQL::Language::Visitor] a visitor to follow & watch the types
# File lib/graphql/static_validation/type_stack.rb, line 37 def initialize(schema, visitor) @schema = schema @object_types = [] @field_definitions = [] @directive_definitions = [] @argument_definitions = [] @path = [] PUSH_STRATEGIES.each do |node_class, strategy| visitor[node_class].enter << EnterWithStrategy.new(self, strategy) visitor[node_class].leave << LeaveWithStrategy.new(self, strategy) end end