Class: GraphQL::Analysis::MaxQueryComplexity
- Inherits:
-
QueryComplexity
- Object
- Analyzer
- QueryComplexity
- GraphQL::Analysis::MaxQueryComplexity
- Defined in:
- lib/graphql/analysis/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::QueryComplexity
Instance Method Details
#result ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/graphql/analysis/max_query_complexity.rb', line 7 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 |