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'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
# 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
# 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
......
......@@ -456,7 +456,7 @@ GEM
graphiql-rails (1.4.10)
railties
sprockets-rails
graphql (1.9.12)
graphql (1.9.19)
graphql-docs (1.6.0)
commonmarker (~> 0.16)
escape_utils (~> 1.2)
......@@ -1252,7 +1252,7 @@ DEPENDENCIES
grape-path-helpers (~> 1.2)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.9.12)
graphql (~> 1.9.19)
graphql-docs (~> 1.6.0)
grpc (~> 1.24.0)
gssapi
......
......@@ -9,7 +9,7 @@ module Mutations
end
def group_resolver
Resolvers::GroupResolver.new(object: nil, context: context)
Resolvers::GroupResolver.new(object: nil, context: context, field: nil)
end
end
end
......@@ -14,7 +14,7 @@ module Mutations
def issuable_resolver(type, parent, context)
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
def resolve_issuable_parent(parent_path)
......
......@@ -9,7 +9,7 @@ module Mutations
end
def project_resolver
Resolvers::ProjectResolver.new(object: nil, context: context)
Resolvers::ProjectResolver.new(object: nil, context: context, field: nil)
end
end
end
......@@ -1294,7 +1294,7 @@
- :name: x509_certificate_revoke
:feature_category: :source_code_management
:has_external_dependencies:
:urgency: :default
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent: true
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -23,7 +23,7 @@ module Mutations
def find_object(group_path:, iid:)
group = resolve_group(full_path: group_path)
resolver = Resolvers::EpicResolver
.single.new(object: group, context: context)
.single.new(object: group, context: context, field: nil)
resolver.resolve(iid: iid)
end
......
......@@ -16,10 +16,10 @@ describe Mutations::DesignManagement::Delete do
let(:design_c) { create(:design, :with_file, issue: issue) }
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
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)
end
......
......@@ -9,7 +9,7 @@ describe Mutations::DesignManagement::Upload do
let(:project) { issue.project }
subject(:mutation) do
described_class.new(object: nil, context: { current_user: user })
described_class.new(object: nil, context: { current_user: user }, field: nil)
end
describe "#resolve" do
......
......@@ -9,7 +9,7 @@ describe Mutations::Epics::AddIssue do
let(:user) { issue.author }
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
subject do
......
......@@ -5,7 +5,7 @@ describe Mutations::Issues::SetWeight do
let(:issue) { create(:issue) }
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
let(:weight) { 2 }
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) }
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
let(:assignees) { create_list(:user, 3) }
......
......@@ -3,7 +3,7 @@
RSpec.shared_examples 'updating health status' do
let(:resource_klass) { resource.class }
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
{ iid: resource.iid, health_status: resource_klass.health_statuses[:at_risk] }.tap do |args|
if resource.is_a?(Epic)
......
......@@ -11,12 +11,12 @@ describe Mutations::ResolvesGroup do
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
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)
end
end
......@@ -12,7 +12,7 @@ describe Mutations::ResolvesIssuable do
let(:project) { create(:project) }
let(:user) { create(: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|
context 'when user has access' do
......@@ -39,7 +39,7 @@ describe Mutations::ResolvesIssuable do
.and_return(resolved_project)
expect(resolver_class).to receive(:new)
.with(object: resolved_project, context: context)
.with(object: resolved_project, context: context, field: nil)
.and_call_original
subject
......@@ -47,7 +47,7 @@ describe Mutations::ResolvesIssuable do
it 'uses the ResolvesProject to resolve project' do
expect(Resolvers::ProjectResolver).to receive(:new)
.with(object: nil, context: context)
.with(object: nil, context: context, field: nil)
.and_call_original
subject
......
......@@ -11,12 +11,12 @@ describe Mutations::ResolvesProject do
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
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)
end
end
......@@ -6,7 +6,7 @@ describe Mutations::Issues::SetConfidential do
let(:issue) { create(:issue) }
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
let(:confidential) { true }
......
......@@ -6,7 +6,7 @@ describe Mutations::Issues::SetDueDate do
let(:issue) { create(:issue) }
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
let(:due_date) { 2.days.since }
......
......@@ -13,7 +13,7 @@ describe Mutations::Issues::Update do
due_date: Date.tomorrow
}
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] }
describe '#resolve' do
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) }
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
let(:assignee) { create(:user) }
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLabels do
let(:merge_request) { create(:merge_request) }
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
let(:label) { create(:label, project: merge_request.project) }
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetLocked do
let(:merge_request) { create(:merge_request) }
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
let(:locked) { true }
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetMilestone do
let(:merge_request) { create(:merge_request) }
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
let(:milestone) { create(:milestone, project: merge_request.project) }
......
......@@ -7,7 +7,7 @@ describe Mutations::MergeRequests::SetSubscription do
let(:project) { merge_request.project }
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
let(:subscribe) { true }
......
......@@ -6,7 +6,7 @@ describe Mutations::MergeRequests::SetWip do
let(:merge_request) { create(:merge_request) }
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
let(:wip) { true }
......
......@@ -48,6 +48,6 @@ describe Mutations::Todos::MarkAllDone do
end
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
......@@ -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(: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
it 'marks a single todo as done' 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(: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
it 'restores a single todo' 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(: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
it 'restores a single todo' do
......
......@@ -12,8 +12,8 @@ module GraphqlHelpers
end
# Run a loader's named resolver
def resolve(resolver_class, obj: nil, args: {}, ctx: {})
resolver_class.new(object: obj, context: ctx).resolve(args)
def resolve(resolver_class, obj: nil, args: {}, ctx: {}, field: nil)
resolver_class.new(object: obj, context: ctx, field: field).resolve(args)
end
# 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