Sha256: 04151b6e16c2c8a43d1a1cb096ed04845a9ea2833f654fbf5e048f27fe5879cb

Contents?: true

Size: 612 Bytes

Versions: 24

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Analysis
    # Used under the hood to implement complexity validation,
    # see {Schema#max_complexity} and {Query#max_complexity}
    class MaxQueryComplexity < QueryComplexity
      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
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
graphql-2.4.8 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.7 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.6 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.5 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.4 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.3 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.2 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.1 lib/graphql/analysis/max_query_complexity.rb
graphql-2.4.0 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.20 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.19 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.18 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.17 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.16 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.15 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.14 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.13 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.12 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.11 lib/graphql/analysis/max_query_complexity.rb
graphql-2.3.10 lib/graphql/analysis/max_query_complexity.rb