Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/graphql/execution/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ def execute
end
query.result
end
end
rescue SystemStackError => err
@multiplex.queries.map do |query|
@schema.query_stack_error(query, err)
query.result_values ||= { "errors" => query.context.errors.map(&:to_h) }
query.result
rescue SystemStackError => err
queries.map do |query|
@schema.query_stack_error(query, err)
query.result_values ||= { "errors" => query.context.errors.map(&:to_h) }
query.result
end
rescue Exception
# Assign values here so that the query's `@executed` becomes true
queries.map { |q| q.result_values ||= {} }
raise
end
ensure
Fiber[:__graphql_current_multiplex] = previous_multiplex
Expand Down
6 changes: 5 additions & 1 deletion spec/graphql/analysis/query_complexity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,11 @@ class Entity < GraphQL::Schema::Union
end

class Query < GraphQL::Schema::Object
field :entity, Entity, fallback_value: nil
field :entity, Entity, fallback_value: nil, resolve_static: true

def self.entity(ctx)
nil
end
end

def self.resolve_type
Expand Down
6 changes: 5 additions & 1 deletion spec/graphql/language/sanitized_printer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,14 @@ class Grouping < GraphQL::Schema::Enum
end

class Query < GraphQL::Schema::Object
field :things, [String] do
field :things, [String], resolve_static: true do
argument :group, Grouping
end

def self.things(ctx, group:)
[group]
end

def things(group:)
[group]
end
Expand Down
3 changes: 2 additions & 1 deletion spec/graphql/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def self.use(schema_defn)

query_type = Class.new(GraphQL::Schema::Object) do
graphql_name 'Query'
field :foobar, Integer, null: false
field :foobar, Integer, null: false, resolve_static: true
def self.foobar(ctx); 1337; end
def foobar; 1337; end
end

Expand Down
Loading