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
+ 18
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -8,10 +8,23 @@ class FieldExtension < ::GraphQL::Schema::FieldExtension
def resolve(object:, arguments:, context:)
attrs = safe_context_values(context)
type = field.owner.kind.abstract? ? object.class : field.owner
object.present(type, attrs)
yield(object, arguments)
# We need to handle the object being either a Schema::Object or an
# inner Schema::Object#object. This depends on whether the field
# has a @resolver_proc or not.
if object.is_a?(::Types::BaseObject)
type = field.owner.kind.abstract? ? object.class : field.owner
object.present(type, attrs)
yield(object, arguments)
else
# This is the legacy code-path, hit if the field has a @resolver_proc
# TODO: remove this when resolve procs are removed from the
# graphql-ruby library, and all field instrumentation is removed.
# See: https://github.com/rmosolgo/graphql-ruby/issues/3385
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/363131
presented = field.owner.try(:present, object, attrs) || object
yield(presented, arguments)
end
end
private
Loading