Class: GraphQL::StaticValidation::Validator::Context
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::Validator::Context
- Defined in:
- lib/graph_ql/static_validation/validator.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#visitor ⇒ Object
readonly
Returns the value of attribute visitor.
Instance Method Summary collapse
- #directive_definition ⇒ Object
- #field_definition ⇒ Object
-
#initialize(schema, document) ⇒ Context
constructor
A new instance of Context.
- #object_types ⇒ Object
Constructor Details
#initialize(schema, document) ⇒ Context
Returns a new instance of Context.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/graph_ql/static_validation/validator.rb', line 21 def initialize(schema, document) @schema = schema @document = document @fragments = document.parts.each_with_object({}) do |part, memo| part.is_a?(GraphQL::Nodes::FragmentDefinition) && memo[part.name] = part end @errors = [] @visitor = GraphQL::Visitor.new @type_stack = GraphQL::StaticValidation::TypeStack.new(schema, visitor) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
20 21 22 |
# File 'lib/graph_ql/static_validation/validator.rb', line 20 def document @document end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
20 21 22 |
# File 'lib/graph_ql/static_validation/validator.rb', line 20 def errors @errors end |
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
20 21 22 |
# File 'lib/graph_ql/static_validation/validator.rb', line 20 def fragments @fragments end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
20 21 22 |
# File 'lib/graph_ql/static_validation/validator.rb', line 20 def schema @schema end |
#visitor ⇒ Object (readonly)
Returns the value of attribute visitor.
20 21 22 |
# File 'lib/graph_ql/static_validation/validator.rb', line 20 def visitor @visitor end |
Instance Method Details
#directive_definition ⇒ Object
40 41 42 |
# File 'lib/graph_ql/static_validation/validator.rb', line 40 def directive_definition @type_stack.directive_definitions.last end |
#field_definition ⇒ Object
36 37 38 |
# File 'lib/graph_ql/static_validation/validator.rb', line 36 def field_definition @type_stack.field_definitions.last end |
#object_types ⇒ Object
32 33 34 |
# File 'lib/graph_ql/static_validation/validator.rb', line 32 def object_types @type_stack.object_types end |