Class: GraphQL::StaticValidation::FragmentsAreUsed
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::FragmentsAreUsed
- Includes:
- Message::MessageHelper
- Defined in:
- lib/graph_ql/static_validation/rules/fragments_are_used.rb
Instance Method Summary collapse
Methods included from Message::MessageHelper
Instance Method Details
#validate(context) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/graph_ql/static_validation/rules/fragments_are_used.rb', line 4 def validate(context) v = context.visitor used_fragments = [] defined_fragments = [] v[GraphQL::Nodes::FragmentSpread] << -> (node, parent) { used_fragments << node } v[GraphQL::Nodes::FragmentDefinition] << -> (node, parent) { defined_fragments << node} v[GraphQL::Nodes::Document].leave << -> (node, parent) { add_errors(context.errors, used_fragments, defined_fragments) } end |