Module: RailsAuditLog::Graphql::SchemaPlugin
- Defined in:
- lib/rails_audit_log/graphql/schema_plugin.rb
Overview
Schema-level plugin that applies query-protection limits and enables dataloader batching in one include.
Include in your GraphQL schema class:
class MySchema < GraphQL::Schema
include RailsAuditLog::Graphql::SchemaPlugin
query Types::QueryType
end
This applies the following defaults (all overridable via RailsAuditLog::Graphql class-level accessors):
| Setting | Default | Description | |————————|———|————————————————–| | max_complexity | 200 | Reject queries whose complexity exceeds this | | max_depth | 10 | Reject queries nested deeper than this | | default_max_page_size| 25 | Page-size assumption for connection complexity |
Also enables GraphQL::Dataloader for N+1-free batch loading of actor.record and auditedResource.record fields.
Class Method Summary collapse
- .included(base) ⇒ Object private
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 |
# File 'lib/rails_audit_log/graphql/schema_plugin.rb', line 28 def self.included(base) base.max_complexity(RailsAuditLog::Graphql.max_complexity) base.max_depth(RailsAuditLog::Graphql.max_depth) base.default_max_page_size(RailsAuditLog::Graphql.default_max_page_size) base.use(GraphQL::Dataloader) end |