Sha256: c1bf87f45328dcd1f4087d5f8faeba72c54f81c2f8d8bcaed42f6eca26525244

Contents?: true

Size: 651 Bytes

Versions: 68

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module StaticValidation
    class FragmentsAreFinite
      include GraphQL::StaticValidation::Message::MessageHelper

      def validate(context)
        context.visitor[GraphQL::Language::Nodes::Document].leave << ->(_n, _p) do
          dependency_map = context.dependencies
          dependency_map.cyclical_definitions.each do |defn|
            if defn.node.is_a?(GraphQL::Language::Nodes::FragmentDefinition)
              context.errors << message("Fragment #{defn.name} contains an infinite loop", defn.node, path: defn.path)
            end
          end
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
graphql-1.8.0.pre10 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.14 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre9 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre8 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.13 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre7 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.12 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.11 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.10 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre6 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre5 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.9 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre4 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre3 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.8 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre2 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.7 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.8.0.pre1 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.6 lib/graphql/static_validation/rules/fragments_are_finite.rb
graphql-1.7.5 lib/graphql/static_validation/rules/fragments_are_finite.rb