Commit fde740dc authored by Michael Kozono's avatar Michael Kozono

Merge branch 'upgrade-graphql' into 'master'

Upgrade GraphQL gem

See merge request gitlab-org/gitlab!40416
parents 6412f8ae 75cce915
......@@ -89,7 +89,7 @@ gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
# GraphQL API
gem 'graphql', '~> 1.10.5'
gem 'graphql', '~> 1.11.4'
# NOTE: graphiql-rails v1.5+ doesn't work: https://gitlab.com/gitlab-org/gitlab/issues/31771
# TODO: remove app/views/graphiql/rails/editors/show.html.erb when https://github.com/rmosolgo/graphiql-rails/pull/71 is released:
# https://gitlab.com/gitlab-org/gitlab/issues/31747
......
......@@ -505,7 +505,7 @@ GEM
graphiql-rails (1.4.10)
railties
sprockets-rails
graphql (1.10.5)
graphql (1.11.4)
graphql-docs (1.6.0)
commonmarker (~> 0.16)
escape_utils (~> 1.2)
......@@ -1346,7 +1346,7 @@ DEPENDENCIES
grape-path-helpers (~> 1.3)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.10.5)
graphql (~> 1.11.4)
graphql-docs (~> 1.6.0)
grpc (~> 1.30.2)
gssapi
......
......@@ -5,7 +5,7 @@ module Mutations
class Toggle < Base
graphql_name 'AwardEmojiToggle'
field :toggledOn, GraphQL::BOOLEAN_TYPE, null: false,
field :toggled_on, GraphQL::BOOLEAN_TYPE, null: false,
description: 'Indicates the status of the emoji. ' \
'True if the toggle awarded the emoji, and false if the toggle removed the emoji.'
......
......@@ -18,6 +18,34 @@ module Types
super(*args, **kwargs, &block)
end
# Based on https://github.com/rmosolgo/graphql-ruby/blob/v1.11.4/lib/graphql/schema/field.rb#L538-L563
# Modified to fix https://github.com/rmosolgo/graphql-ruby/issues/3113
def resolve_field(obj, args, ctx)
ctx.schema.after_lazy(obj) do |after_obj|
query_ctx = ctx.query.context
inner_obj = after_obj && after_obj.object
ctx.schema.after_lazy(to_ruby_args(after_obj, args, ctx)) do |ruby_args|
if authorized?(inner_obj, ruby_args, query_ctx)
if @resolve_proc
# We pass `after_obj` here instead of `inner_obj` because extensions expect a GraphQL::Schema::Object
with_extensions(after_obj, ruby_args, query_ctx) do |extended_obj, extended_args|
# Since `extended_obj` is now a GraphQL::Schema::Object, we need to get the inner object and pass that to `@resolve_proc`
extended_obj = extended_obj.object if extended_obj.is_a?(GraphQL::Schema::Object)
@resolve_proc.call(extended_obj, args, ctx)
end
else
public_send_field(after_obj, ruby_args, query_ctx)
end
else
err = GraphQL::UnauthorizedFieldError.new(object: inner_obj, type: obj.class, context: ctx, field: self)
query_ctx.schema.unauthorized_field(err)
end
end
end
end
def base_complexity
complexity = DEFAULT_COMPLEXITY
complexity += 1 if calls_gitaly?
......
......@@ -19,7 +19,7 @@ module Types
project.available_scanners
end
field :pipelineRun, [::Types::SecurityScannerTypeEnum], null: true,
field :pipeline_run, [::Types::SecurityScannerTypeEnum], null: true,
description: 'List of analyzers which ran successfully in the latest pipeline.',
calls_gitaly: true,
resolve: -> (project, _args, ctx) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment