Class: GraphQL::Analysis::AST::MaxQueryComplexity
- Inherits:
 - 
      QueryComplexity
      
        
- Object
 - Analyzer
 - QueryComplexity
 - GraphQL::Analysis::AST::MaxQueryComplexity
 
 
- Defined in:
 - lib/graphql/analysis/ast/max_query_complexity.rb
 
Overview
Used under the hood to implement complexity validation, see Schema#max_complexity and Query#max_complexity
Instance Method Summary collapse
Methods inherited from QueryComplexity
#initialize, #on_enter_field, #on_leave_field
Methods inherited from Analyzer
#analyze?, #initialize, #visit?
Constructor Details
This class inherits a constructor from GraphQL::Analysis::AST::QueryComplexity
Instance Method Details
#result ⇒ Object
      8 9 10 11 12 13 14 15 16 17 18  | 
    
      # File 'lib/graphql/analysis/ast/max_query_complexity.rb', line 8 def result return if subject.max_complexity.nil? total_complexity = max_possible_complexity if total_complexity > subject.max_complexity GraphQL::AnalysisError.new("Query has complexity of #{total_complexity}, which exceeds max complexity of #{subject.max_complexity}") else nil end end  |