Sha256: 1268712732f99fd339697cd6d3b567d2def009d00413f18d51057cd872d77706

Contents?: true

Size: 693 Bytes

Versions: 13

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true
require_relative "./query_complexity"
module GraphQL
  module Analysis
    module AST
      # Used under the hood to implement complexity validation,
      # see {Schema#max_complexity} and {Query#max_complexity}
      class MaxQueryComplexity < QueryComplexity
        def result
          return if query.max_complexity.nil?

          total_complexity = max_possible_complexity

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql-1.9.15 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.14 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.10.0.pre1 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.13 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.12 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.11 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.10 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.9 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.8 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.7 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.6 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.5 lib/graphql/analysis/ast/max_query_complexity.rb
graphql-1.9.4 lib/graphql/analysis/ast/max_query_complexity.rb