Class: GraphQL::Analysis::AST::MaxQueryDepth

Inherits:
QueryDepth show all
Defined in:
lib/graphql/analysis/ast/max_query_depth.rb

Instance Method Summary collapse

Methods inherited from QueryDepth

#initialize, #on_enter_field, #on_leave_field

Methods inherited from Analyzer

#analyze?, build_visitor_hooks, #initialize

Constructor Details

This class inherits a constructor from GraphQL::Analysis::AST::QueryDepth

Instance Method Details

#resultObject



6
7
8
9
10
11
12
13
14
# File 'lib/graphql/analysis/ast/max_query_depth.rb', line 6

def result
  return unless query.max_depth

  if @max_depth > query.max_depth
    GraphQL::AnalysisError.new("Query has depth of #{@max_depth}, which exceeds max depth of #{query.max_depth}")
  else
    nil
  end
end