class GraphQL::Analysis::MaxQueryDepth
MySchema.query_analyzers << GraphQL::Analysis::MaxQueryDepth.new(10)
# Does this for you based on your ‘max_depth` setting
# DON’T actually do this, graphql-ruby
@example Assert max depth of 10
see {Schema#max_depth} and {Query#max_depth}
Used under the hood to implement depth validation,
def initialize(max_depth)
def initialize(max_depth) disallow_excessive_depth = ->(query, depth) { if depth > max_depth GraphQL::AnalysisError.new("Query has depth of #{depth}, which exceeds max depth of #{max_depth}") else nil end } super(&disallow_excessive_depth) end