Class: GraphQL::StaticValidation::SubscriptionRootExists
- Inherits:
-
Object
- Object
- GraphQL::StaticValidation::SubscriptionRootExists
- Includes:
- Message::MessageHelper
- Defined in:
- lib/graphql/static_validation/rules/subscription_root_exists.rb
Instance Method Summary collapse
Methods included from Message::MessageHelper
Instance Method Details
#validate(context) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/graphql/static_validation/rules/subscription_root_exists.rb', line 6 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 << ('Schema is not configured for subscriptions', ast_node, context: context) return GraphQL::Language::Visitor::SKIP end } end |