Skip to content
Snippets Groups Projects

[graphql] Convert to using the new query interpreter runtime

Merged Brett Walker requested to merge bw-graphql-interpreter into master
1 unresolved thread
Compare and Show latest version
2 files
+ 43
66
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -55,24 +55,24 @@ def authorized?(object, args, ctx)
# This gets called from the gem's `calculate_complexity` method, allowing us
# to ensure our complexity calculation is used even for connections
def complexity_for(child_complexity:, query:, lookahead:)
defined_complexity = complexity
case defined_complexity
when Proc
arguments = query.arguments_for(lookahead.ast_nodes.first, self)
if arguments.respond_to?(:keyword_arguments)
defined_complexity.call(query.context, arguments.keyword_arguments, child_complexity)
else
child_complexity
end
when Numeric
defined_complexity + child_complexity
else
raise("Invalid complexity: #{defined_complexity.inspect} on #{path} (#{inspect})")
end
end
# def complexity_for(child_complexity:, query:, lookahead:)
# defined_complexity = complexity
#
# case defined_complexity
# when Proc
# arguments = query.arguments_for(lookahead.ast_nodes.first, self)
#
# if arguments.respond_to?(:keyword_arguments)
# defined_complexity.call(query.context, arguments.keyword_arguments, child_complexity)
# else
# child_complexity
# end
# when Numeric
# defined_complexity + child_complexity
# else
# raise("Invalid complexity: #{defined_complexity.inspect} on #{path} (#{inspect})")
# end
# end
def base_complexity
complexity = DEFAULT_COMPLEXITY
Loading