module GraphQL::StaticValidation::FragmentSpreadsArePossible
Public Class Methods
(GraphQL::Language::Nodes::Document document, GraphQL::StaticValidation::ValidationContext context) → void
Source
# File lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb, line 11 def initialize(document, context) super @spreads_to_validate = [] #: Array[FragmentSpread] end
Calls superclass method
Public Instance Methods
(GraphQL::Language::Nodes::Document node, GraphQL::Language::Nodes::AbstractNode? parent) → void
Source
# File lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb, line 34 def on_document(node, parent) super @spreads_to_validate.each do |frag_spread| frag_node = context.fragments[frag_spread.node.name] if frag_node fragment_child_name = frag_node.type.name fragment_child = types.type(fragment_child_name) # Might be non-existent type name if fragment_child validate_fragment_in_scope(frag_spread.parent_type, fragment_child, frag_spread.node, context, frag_spread.path) end end end end
Calls superclass method
(GraphQL::Language::Nodes::FragmentSpread node, GraphQL::Language::Nodes::AbstractNode? parent) → void
Source
# File lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb, line 27 def on_fragment_spread(node, parent) fragment_parent = type_definition @spreads_to_validate << FragmentSpread.new(node: node, parent_type: fragment_parent, path: context.path) super end
Calls superclass method
(GraphQL::Language::Nodes::InlineFragment node, GraphQL::Language::Nodes::AbstractNode? parent) → void
Source
# File lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb, line 17 def on_inline_fragment(node, parent) fragment_parent = parent_type_definition fragment_child = type_definition if fragment_child validate_fragment_in_scope(fragment_parent, fragment_child, node, context, context.path) end super end
Calls superclass method