Class: GraphQL::StaticValidation::TypeStack
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::TypeStack
- Defined in:
- lib/graph_ql/static_validation/type_stack.rb
Overview
-
Ride along with ‘GraphQL::Visitor`
-
Track type info, expose it to validators
Defined Under Namespace
Classes: DirectiveStrategy, FieldStrategy, FragmentDefinitionStrategy, FragmentWithTypeStrategy, InlineFragmentStrategy, NullStrategy, OperationDefinitionStrategy
Constant Summary collapse
- TYPE_INFERRENCE_ROOTS =
These are jumping-off points for infering types down the tree
[ GraphQL::Nodes::OperationDefinition, GraphQL::Nodes::FragmentDefinition, ]
Instance Attribute Summary collapse
-
#directive_definitions ⇒ Object
readonly
Returns the value of attribute directive_definitions.
-
#field_definitions ⇒ Object
readonly
Returns the value of attribute field_definitions.
-
#object_types ⇒ Object
readonly
Returns the value of attribute object_types.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(schema, visitor) ⇒ TypeStack
constructor
A new instance of TypeStack.
Constructor Details
#initialize(schema, visitor) ⇒ TypeStack
Returns a new instance of TypeStack.
11 12 13 14 15 16 17 18 |
# File 'lib/graph_ql/static_validation/type_stack.rb', line 11 def initialize(schema, visitor) @schema = schema @object_types = [] @field_definitions = [] @directive_definitions = [] visitor.enter << -> (node, parent) { PUSH_STRATEGIES[node.class].push(self, node) } visitor.leave << -> (node, parent) { PUSH_STRATEGIES[node.class].pop(self, node) } end |
Instance Attribute Details
#directive_definitions ⇒ Object (readonly)
Returns the value of attribute directive_definitions.
10 11 12 |
# File 'lib/graph_ql/static_validation/type_stack.rb', line 10 def directive_definitions @directive_definitions end |
#field_definitions ⇒ Object (readonly)
Returns the value of attribute field_definitions.
10 11 12 |
# File 'lib/graph_ql/static_validation/type_stack.rb', line 10 def field_definitions @field_definitions end |
#object_types ⇒ Object (readonly)
Returns the value of attribute object_types.
10 11 12 |
# File 'lib/graph_ql/static_validation/type_stack.rb', line 10 def object_types @object_types end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
10 11 12 |
# File 'lib/graph_ql/static_validation/type_stack.rb', line 10 def schema @schema end |