class GraphQL::StaticValidation::TypeStack

Constants

PUSH_STRATEGIES
TYPE_INFERRENCE_ROOTS

These are jumping-off points for infering types down the tree

Attributes

argument_definitions[R]

@return [Array<GraphQL::Node::Argument>] arguments which have been entered

directive_definitions[R]

Directives are pushed on, then popped off while traversing the tree @return [Array<GraphQL::Node::Directive>] directives which have been entered

field_definitions[R]

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

object_types[R]

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>]

path[R]

@return [Array<String>] fields which have been entered (by their AST name)

schema[R]

@return [GraphQL::Schema] the schema whose types are present in this document

Public Class Methods

new(schema, visitor) click to toggle source

@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 38
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