Sha256: 35b536e4407e25e4ec58c8fc65d6feeda02ae97413daf26cc8c3c6a16e7f18f9

Contents?: true

Size: 525 Bytes

Versions: 10

Compression:

Stored size: 525 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

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.5 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.4 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.3 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.2 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.1 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.2.0 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.1.0 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-1.0.0 lib/graphql/static_validation/rules/fragments_are_named.rb
graphql-0.19.4 lib/graphql/static_validation/rules/fragments_are_named.rb