Sha256: d0d263c03dc1cd39cacd3e57aab417e6351052d03186826db7ca90490488fcb6

Contents?: true

Size: 622 Bytes

Versions: 10

Compression:

Stored size: 622 Bytes

Contents

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

      def validate(context)
        return if context.schema.subscription

        visitor = context.visitor

        visitor[GraphQL::Language::Nodes::OperationDefinition].enter << ->(ast_node, prev_ast_node) {
          if ast_node.operation_type == 'subscription'
            context.errors << message('Schema is not configured for subscriptions', ast_node, context: context)
            return GraphQL::Language::Visitor::SKIP
          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/subscription_root_exists.rb
graphql-1.2.5 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.2.4 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.2.3 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.2.2 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.2.1 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.2.0 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.1.0 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-1.0.0 lib/graphql/static_validation/rules/subscription_root_exists.rb
graphql-0.19.4 lib/graphql/static_validation/rules/subscription_root_exists.rb