Module: GraphQL::StaticValidation::QueryRootExists
- Defined in:
- lib/graphql/static_validation/rules/query_root_exists.rb
Overview
-- @requires_ancestor: GraphQL::StaticValidation::BaseVisitor
Instance Method Summary collapse
-
#on_operation_definition(node, _parent) ⇒ Object
: (GraphQL::Language::Nodes::OperationDefinition node, GraphQL::Language::Nodes::AbstractNode? _parent) -> void.
Instance Method Details
#on_operation_definition(node, _parent) ⇒ Object
: (GraphQL::Language::Nodes::OperationDefinition node, GraphQL::Language::Nodes::AbstractNode? _parent) -> void
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql/static_validation/rules/query_root_exists.rb', line 10 def on_operation_definition(node, _parent) if (node.operation_type == 'query' || node.operation_type.nil?) && context.types.query_root.nil? add_error(GraphQL::StaticValidation::QueryRootExistsError.new( 'Schema is not configured for queries', nodes: node )) else super end end |