class GraphQL::StaticValidation::BaseVisitor
Attributes
Public Class Methods
# File lib/graphql/static_validation/base_visitor.rb, line 49 def self.including_rules(rules) if rules.empty? # It's not doing _anything?!?_ BaseVisitor elsif rules == ALL_RULES InterpreterVisitor else visitor_class = Class.new(self) do include(GraphQL::StaticValidation::DefinitionDependencies) end rules.reverse_each do |r| # If it's a class, it gets attached later. if !r.is_a?(Class) visitor_class.include(r) end end visitor_class.include(ContextMethods) visitor_class end end
Build a class to visit the AST and perform validation, or use a pre-built class if rules is ALL_RULES or empty.
Parameters
-
rules(Array<Module, Class>)
Returns
-
Class— A class for validatingrulesduring visitation
Source
# File lib/graphql/static_validation/base_visitor.rb, line 6 def initialize(document, context) @path = [] @path_depth = 0 @current_object_type = nil @parent_object_type = nil @current_field_definition = nil @current_argument_definition = nil @parent_argument_definition = nil @current_directive_definition = nil @context = context @types = context.query.types @schema = context.schema @inline_fragment_paths = {} @field_unwrapped_types = {}.compare_by_identity @child_positions = {}.compare_by_identity super(document) end
Calls superclass method
GraphQL::Language::StaticVisitor::new
Public Instance Methods
Source
# File lib/graphql/static_validation/base_visitor.rb, line 32 def path @path[0, @path_depth] end
Returns
-
Array<String>— The nesting of the current position in the AST