module GraphQL::StaticValidation::QueryRootExists

Public Instance Methods

on_operation_definition(node, _parent) click to toggle source
Calls superclass method
# File lib/graphql/static_validation/rules/query_root_exists.rb, line 5
def on_operation_definition(node, _parent)
  if (node.operation_type == 'query' || node.operation_type.nil?) && context.warden.root_type_for_operation("query").nil?
    add_error(GraphQL::StaticValidation::QueryRootExistsError.new(
      'Schema is not configured for queries',
      nodes: node
    ))
  else
    super
  end
end