Sha256: 9601f05e18186a34e742fa43f6fb3621154eefdf32cc8a5340d341f3930c2037

Contents?: true

Size: 526 Bytes

Versions: 13

Compression:

Stored size: 526 Bytes

Contents

module GraphQL
  module StaticValidation
    class FragmentsAreNamed
      include GraphQL::StaticValidation::Message::MessageHelper

      def validate(context)
        context.visitor[GraphQL::Language::Nodes::FragmentDefinition] << -> (node, parent) { validate_name_exists(node, context) }
      end

      private

      def validate_name_exists(node, context)
        if node.name.nil?
          context.errors << message("Fragment definition has no name", node, context: context)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql-0.19.3 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.19.2 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.19.1 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.19.0 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.15 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.14 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.13 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.12 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.11 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.10 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.9 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.8 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.18.7 lib/graphql/static_validation/rules/fragments_are_named.rb