Commit c5547d77 authored by Brett Walker's avatar Brett Walker

Upgrade graphql gem to 1.9.19

A new `field` parameter was added to the resolver initializers,
requiring several changes
parent 1957302d
...@@ -87,7 +87,7 @@ gem 'grape-entity', '~> 0.7.1' ...@@ -87,7 +87,7 @@ gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors' gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
# GraphQL API # GraphQL API
gem 'graphql', '~> 1.9.12' gem 'graphql', '~> 1.9.19'
# NOTE: graphiql-rails v1.5+ doesn't work: https://gitlab.com/gitlab-org/gitlab/issues/31771 # 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: # 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 # https://gitlab.com/gitlab-org/gitlab/issues/31747
......
...@@ -456,7 +456,7 @@ GEM ...@@ -456,7 +456,7 @@ GEM
graphiql-rails (1.4.10) graphiql-rails (1.4.10)
railties railties
sprockets-rails sprockets-rails
graphql (1.9.12) graphql (1.9.19)
graphql-docs (1.6.0) graphql-docs (1.6.0)
commonmarker (~> 0.16) commonmarker (~> 0.16)
escape_utils (~> 1.2) escape_utils (~> 1.2)
...@@ -1252,7 +1252,7 @@ DEPENDENCIES ...@@ -1252,7 +1252,7 @@ DEPENDENCIES
grape-path-helpers (~> 1.2) grape-path-helpers (~> 1.2)
grape_logging (~> 1.7) grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10) graphiql-rails (~> 1.4.10)
graphql (~> 1.9.12) graphql (~> 1.9.19)
graphql-docs (~> 1.6.0) graphql-docs (~> 1.6.0)
grpc (~> 1.24.0) grpc (~> 1.24.0)
gssapi gssapi
......
...@@ -9,7 +9,7 @@ module Mutations ...@@ -9,7 +9,7 @@ module Mutations
end end
def group_resolver def group_resolver
Resolvers::GroupResolver.new(object: nil, context: context) Resolvers::GroupResolver.new(object: nil, context: context, field: nil)
end end
end end
end end
...@@ -14,7 +14,7 @@ module Mutations ...@@ -14,7 +14,7 @@ module Mutations
def issuable_resolver(type, parent, context) def issuable_resolver(type, parent, context)
resolver_class = "Resolvers::#{type.to_s.classify.pluralize}Resolver".constantize resolver_class = "Resolvers::#{type.to_s.classify.pluralize}Resolver".constantize
resolver_class.single.new(object: parent, context: context) resolver_class.single.new(object: parent, context: context, field: nil)
end end
def resolve_issuable_parent(parent_path) def resolve_issuable_parent(parent_path)
......
...@@ -9,7 +9,7 @@ module Mutations ...@@ -9,7 +9,7 @@ module Mutations
end end
def project_resolver def project_resolver
Resolvers::ProjectResolver.new(object: nil, context: context) Resolvers::ProjectResolver.new(object: nil, context: context, field: nil)
end end
end end
end end
...@@ -1294,7 +1294,7 @@ ...@@ -1294,7 +1294,7 @@
- :name: x509_certificate_revoke - :name: x509_certificate_revoke
:feature_category: :source_code_management :feature_category: :source_code_management
:has_external_dependencies: :has_external_dependencies:
:urgency: :default :urgency: :low
:resource_boundary: :unknown :resource_boundary: :unknown
:weight: 1 :weight: 1
:idempotent: true :idempotent: true
...@@ -23,7 +23,7 @@ module Mutations ...@@ -23,7 +23,7 @@ module Mutations
def find_object(group_path:, iid:) def find_object(group_path:, iid:)
group = resolve_group(full_path: group_path) group = resolve_group(full_path: group_path)
resolver = Resolvers::EpicResolver resolver = Resolvers::EpicResolver
.single.new(object: group, context: context) .single.new(object: group, context: context, field: nil)
resolver.resolve(iid: iid) resolver.resolve(iid: iid)
end end
......
...@@ -16,10 +16,10 @@ describe Mutations::DesignManagement::Delete do ...@@ -16,10 +16,10 @@ describe Mutations::DesignManagement::Delete do
let(:design_c) { create(:design, :with_file, issue: issue) } let(:design_c) { create(:design, :with_file, issue: issue) }
let(:filenames) { [design_a, design_b, design_c].map(&:filename) } let(:filenames) { [design_a, design_b, design_c].map(&:filename) }
let(:mutation) { described_class.new(object: nil, context: { current_user: user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
def run_mutation def run_mutation
mutation = described_class.new(object: nil, context: { current_user: user }) mutation = described_class.new(object: nil, context: { current_user: user }, field: nil)
mutation.resolve(project_path: project.full_path, iid: issue.iid, filenames: filenames) mutation.resolve(project_path: project.full_path, iid: issue.iid, filenames: filenames)
end end
......
...@@ -9,7 +9,7 @@ describe Mutations::DesignManagement::Upload do ...@@ -9,7 +9,7 @@ describe Mutations::DesignManagement::Upload do
let(:project) { issue.project } let(:project) { issue.project }
subject(:mutation) do subject(:mutation) do
described_class.new(object: nil, context: { current_user: user }) described_class.new(object: nil, context: { current_user: user }, field: nil)
end end
describe "#resolve" do describe "#resolve" do
......
...@@ -9,7 +9,7 @@ describe Mutations::Epics::AddIssue do ...@@ -9,7 +9,7 @@ describe Mutations::Epics::AddIssue do
let(:user) { issue.author } let(:user) { issue.author }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
subject(:mutation) { described_class.new(object: group, context: { current_user: user }) } subject(:mutation) { described_class.new(object: group, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
subject do subject do
......
...@@ -5,7 +5,7 @@ describe Mutations::Issues::SetWeight do ...@@ -5,7 +5,7 @@ describe Mutations::Issues::SetWeight do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:weight) { 2 } let(:weight) { 2 }
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:assignees) { create_list(:user, 3) } let(:assignees) { create_list(:user, 3) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
RSpec.shared_examples 'updating health status' do RSpec.shared_examples 'updating health status' do
let(:resource_klass) { resource.class } let(:resource_klass) { resource.class }
let(:mutated_resource) { subject[resource_klass.underscore.to_sym] } let(:mutated_resource) { subject[resource_klass.underscore.to_sym] }
let(:mutation) { described_class.new(object: nil, context: { current_user: user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
let(:params) do let(:params) do
{ iid: resource.iid, health_status: resource_klass.health_statuses[:at_risk] }.tap do |args| { iid: resource.iid, health_status: resource_klass.health_statuses[:at_risk] }.tap do |args|
if resource.is_a?(Epic) if resource.is_a?(Epic)
......
...@@ -11,12 +11,12 @@ describe Mutations::ResolvesGroup do ...@@ -11,12 +11,12 @@ describe Mutations::ResolvesGroup do
let(:context) { double } let(:context) { double }
subject(:mutation) { mutation_class.new(object: nil, context: context) } subject(:mutation) { mutation_class.new(object: nil, context: context, field: nil) }
it 'uses the GroupsResolver to resolve groups by path' do it 'uses the GroupsResolver to resolve groups by path' do
group = create(:group) group = create(:group)
expect(Resolvers::GroupResolver).to receive(:new).with(object: nil, context: context).and_call_original expect(Resolvers::GroupResolver).to receive(:new).with(object: nil, context: context, field: nil).and_call_original
expect(mutation.resolve_group(full_path: group.full_path).sync).to eq(group) expect(mutation.resolve_group(full_path: group.full_path).sync).to eq(group)
end end
end end
...@@ -12,7 +12,7 @@ describe Mutations::ResolvesIssuable do ...@@ -12,7 +12,7 @@ describe Mutations::ResolvesIssuable do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:context) { { current_user: user } } let(:context) { { current_user: user } }
let(:mutation) { mutation_class.new(object: nil, context: context) } let(:mutation) { mutation_class.new(object: nil, context: context, field: nil) }
shared_examples 'resolving an issuable' do |type| shared_examples 'resolving an issuable' do |type|
context 'when user has access' do context 'when user has access' do
...@@ -39,7 +39,7 @@ describe Mutations::ResolvesIssuable do ...@@ -39,7 +39,7 @@ describe Mutations::ResolvesIssuable do
.and_return(resolved_project) .and_return(resolved_project)
expect(resolver_class).to receive(:new) expect(resolver_class).to receive(:new)
.with(object: resolved_project, context: context) .with(object: resolved_project, context: context, field: nil)
.and_call_original .and_call_original
subject subject
...@@ -47,7 +47,7 @@ describe Mutations::ResolvesIssuable do ...@@ -47,7 +47,7 @@ describe Mutations::ResolvesIssuable do
it 'uses the ResolvesProject to resolve project' do it 'uses the ResolvesProject to resolve project' do
expect(Resolvers::ProjectResolver).to receive(:new) expect(Resolvers::ProjectResolver).to receive(:new)
.with(object: nil, context: context) .with(object: nil, context: context, field: nil)
.and_call_original .and_call_original
subject subject
......
...@@ -11,12 +11,12 @@ describe Mutations::ResolvesProject do ...@@ -11,12 +11,12 @@ describe Mutations::ResolvesProject do
let(:context) { double } let(:context) { double }
subject(:mutation) { mutation_class.new(object: nil, context: context) } subject(:mutation) { mutation_class.new(object: nil, context: context, field: nil) }
it 'uses the ProjectsResolver to resolve projects by path' do it 'uses the ProjectsResolver to resolve projects by path' do
project = create(:project) project = create(:project)
expect(Resolvers::ProjectResolver).to receive(:new).with(object: nil, context: context).and_call_original expect(Resolvers::ProjectResolver).to receive(:new).with(object: nil, context: context, field: nil).and_call_original
expect(mutation.resolve_project(full_path: project.full_path).sync).to eq(project) expect(mutation.resolve_project(full_path: project.full_path).sync).to eq(project)
end end
end end
...@@ -6,7 +6,7 @@ describe Mutations::Issues::SetConfidential do ...@@ -6,7 +6,7 @@ describe Mutations::Issues::SetConfidential do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:confidential) { true } let(:confidential) { true }
......
...@@ -6,7 +6,7 @@ describe Mutations::Issues::SetDueDate do ...@@ -6,7 +6,7 @@ describe Mutations::Issues::SetDueDate do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:due_date) { 2.days.since } let(:due_date) { 2.days.since }
......
...@@ -13,7 +13,7 @@ describe Mutations::Issues::Update do ...@@ -13,7 +13,7 @@ describe Mutations::Issues::Update do
due_date: Date.tomorrow due_date: Date.tomorrow
} }
end end
let(:mutation) { described_class.new(object: nil, context: { current_user: user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
let(:mutated_issue) { subject[:issue] } let(:mutated_issue) { subject[:issue] }
describe '#resolve' do describe '#resolve' do
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:assignee) { create(:user) } let(:assignee) { create(:user) }
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLabels do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLabels do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:label) { create(:label, project: merge_request.project) } let(:label) { create(:label, project: merge_request.project) }
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLocked do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLocked do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:locked) { true } let(:locked) { true }
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetMilestone do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetMilestone do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:milestone) { create(:milestone, project: merge_request.project) } let(:milestone) { create(:milestone, project: merge_request.project) }
......
...@@ -7,7 +7,7 @@ describe Mutations::MergeRequests::SetSubscription do ...@@ -7,7 +7,7 @@ describe Mutations::MergeRequests::SetSubscription do
let(:project) { merge_request.project } let(:project) { merge_request.project }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:subscribe) { true } let(:subscribe) { true }
......
...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetWip do ...@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetWip do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
describe '#resolve' do describe '#resolve' do
let(:wip) { true } let(:wip) { true }
......
...@@ -48,6 +48,6 @@ describe Mutations::Todos::MarkAllDone do ...@@ -48,6 +48,6 @@ describe Mutations::Todos::MarkAllDone do
end end
def mutation_for(user) def mutation_for(user)
described_class.new(object: nil, context: { current_user: user }) described_class.new(object: nil, context: { current_user: user }, field: nil)
end end
end end
...@@ -14,7 +14,7 @@ describe Mutations::Todos::MarkDone do ...@@ -14,7 +14,7 @@ describe Mutations::Todos::MarkDone do
let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :pending) } let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :pending) }
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
describe '#resolve' do describe '#resolve' do
it 'marks a single todo as done' do it 'marks a single todo as done' do
......
...@@ -12,7 +12,7 @@ describe Mutations::Todos::RestoreMany do ...@@ -12,7 +12,7 @@ describe Mutations::Todos::RestoreMany do
let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :done) } let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :done) }
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
describe '#resolve' do describe '#resolve' do
it 'restores a single todo' do it 'restores a single todo' do
......
...@@ -12,7 +12,7 @@ describe Mutations::Todos::Restore do ...@@ -12,7 +12,7 @@ describe Mutations::Todos::Restore do
let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :done) } let_it_be(:other_user_todo) { create(:todo, user: other_user, author: author, state: :done) }
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }) } let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
describe '#resolve' do describe '#resolve' do
it 'restores a single todo' do it 'restores a single todo' do
......
...@@ -12,8 +12,8 @@ module GraphqlHelpers ...@@ -12,8 +12,8 @@ module GraphqlHelpers
end end
# Run a loader's named resolver # Run a loader's named resolver
def resolve(resolver_class, obj: nil, args: {}, ctx: {}) def resolve(resolver_class, obj: nil, args: {}, ctx: {}, field: nil)
resolver_class.new(object: obj, context: ctx).resolve(args) resolver_class.new(object: obj, context: ctx, field: field).resolve(args)
end end
# Eagerly run a loader's named resolver # Eagerly run a loader's named resolver
......
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