summaryrefslogtreecommitdiff
path: root/app/graphql/gitlab_schema.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/gitlab_schema.rb')
-rw-r--r--app/graphql/gitlab_schema.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/graphql/gitlab_schema.rb b/app/graphql/gitlab_schema.rb
index 2f5043f9ffa..d66a2333d11 100644
--- a/app/graphql/gitlab_schema.rb
+++ b/app/graphql/gitlab_schema.rb
@@ -30,6 +30,8 @@ class GitlabSchema < GraphQL::Schema
default_max_page_size 100
+ lazy_resolve ::Gitlab::Graphql::Lazy, :force
+
class << self
def multiplex(queries, **kwargs)
kwargs[:max_complexity] ||= max_query_complexity(kwargs[:context])
@@ -76,6 +78,13 @@ class GitlabSchema < GraphQL::Schema
find_by_gid(gid)
end
+ def resolve_type(type, object, ctx = :__undefined__)
+ tc = type.metadata[:type_class]
+ return if tc.respond_to?(:assignable?) && !tc.assignable?(object)
+
+ super
+ end
+
# Find an object by looking it up from its 'GlobalID'.
#
# * For `ApplicationRecord`s, this is equivalent to