Module: GraphQL::StaticValidation::FragmentsAreFinite
- Defined in:
- lib/graphql/static_validation/rules/fragments_are_finite.rb
Overview
-- @requires_ancestor: GraphQL::StaticValidation::BaseVisitor
Instance Method Summary collapse
-
#on_document(_n, _p) ⇒ Object
: (GraphQL::Language::Nodes::Document _n, GraphQL::Language::Nodes::AbstractNode? _p) -> void.
Instance Method Details
#on_document(_n, _p) ⇒ Object
: (GraphQL::Language::Nodes::Document _n, GraphQL::Language::Nodes::AbstractNode? _p) -> void
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql/static_validation/rules/fragments_are_finite.rb', line 10 def on_document(_n, _p) super dependency_map = context.dependencies dependency_map.cyclical_definitions.each do |defn| if defn.node.is_a?(GraphQL::Language::Nodes::FragmentDefinition) add_error(GraphQL::StaticValidation::FragmentsAreFiniteError.new( "Fragment #{defn.name} contains an infinite loop", nodes: defn.node, path: defn.path, name: defn.name )) end end end |