class GraphQL::StaticValidation::BaseVisitor
Attributes
Public Class Methods
(Array[Module[untyped]]) → singleton(GraphQL::StaticValidation::BaseVisitor)
Source
# File lib/graphql/static_validation/base_visitor.rb, line 53 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
(GraphQL::Language::Nodes::Document document, GraphQL::StaticValidation::ValidationContext context) → void
Source
# File lib/graphql/static_validation/base_visitor.rb, line 7 def initialize(document, context) @path = [] #: Array[String | Integer] @path_depth = 0 #: Integer @current_object_type = nil #: GraphQL::Schema::Member::type_definition? @parent_object_type = nil #: GraphQL::Schema::Member::type_definition? @current_field_definition = nil #: GraphQL::Schema::Field? @current_argument_definition = nil #: GraphQL::Schema::Argument? @parent_argument_definition = nil #: GraphQL::Schema::Argument? @current_directive_definition = nil #: singleton(GraphQL::Schema::Directive)? @context = context #: GraphQL::StaticValidation::ValidationContext @types = context.types #: GraphQL::Schema::Visibility::Profile | GraphQL::Schema::Warden::VisibilityProfile @schema = context.schema #: singleton(GraphQL::Schema) @inline_fragment_paths = {} #: Hash[String, String] @field_unwrapped_types = {}.compare_by_identity #: Hash[GraphQL::Schema::Field, GraphQL::Schema::Member::type_definition] @child_positions = {}.compare_by_identity #: Hash[GraphQL::Language::Nodes::AbstractNode, Hash[GraphQL::Language::Nodes::AbstractNode, Integer]] super(document) end
Calls superclass method
GraphQL::Language::StaticVisitor::new
Public Instance Methods
() → Array[String | Integer]
Source
# File lib/graphql/static_validation/base_visitor.rb, line 35 def path @path[0, @path_depth] #: as !nil end
Returns
-
Array<String>— The nesting of the current position in the AST