Commit 06873677 authored by charlie ablett's avatar charlie ablett

Merge branch '268042-graphql_id_type_cop_fix' into 'master'

Fix Graphql/IDType cop for some files

See merge request gitlab-org/gitlab!45342
parents 6b0c3a59 6d8a9df4
......@@ -1251,10 +1251,8 @@ Graphql/IDType:
Exclude:
- 'ee/app/graphql/ee/mutations/issues/update.rb'
- 'ee/app/graphql/ee/types/boards/board_issue_input_base_type.rb'
- 'ee/app/graphql/mutations/boards/lists/update_limit_metrics.rb'
- 'ee/app/graphql/mutations/instance_security_dashboard/remove_project.rb'
- 'ee/app/graphql/mutations/issues/set_epic.rb'
- 'ee/app/graphql/mutations/issues/set_iteration.rb'
- 'ee/app/graphql/mutations/iterations/update.rb'
- 'ee/app/graphql/resolvers/iterations_resolver.rb'
- 'app/graphql/mutations/boards/create.rb'
......@@ -1262,17 +1260,13 @@ Graphql/IDType:
- 'app/graphql/mutations/boards/lists/update.rb'
- 'app/graphql/mutations/discussions/toggle_resolve.rb'
- 'app/graphql/mutations/issues/update.rb'
- 'app/graphql/mutations/merge_requests/set_milestone.rb'
- 'app/graphql/mutations/metrics/dashboard/annotations/delete.rb'
- 'app/graphql/mutations/notes/create/note.rb'
- 'app/graphql/mutations/notes/update/base.rb'
- 'app/graphql/mutations/snippets/destroy.rb'
- 'app/graphql/mutations/snippets/mark_as_spam.rb'
- 'app/graphql/mutations/snippets/update.rb'
- 'app/graphql/mutations/todos/mark_done.rb'
- 'app/graphql/mutations/todos/restore.rb'
- 'app/graphql/resolvers/board_lists_resolver.rb'
- 'app/graphql/resolvers/board_resolver.rb'
- 'app/graphql/resolvers/boards_resolver.rb'
- 'app/graphql/resolvers/design_management/design_at_version_resolver.rb'
- 'app/graphql/resolvers/design_management/design_resolver.rb'
......
......@@ -6,7 +6,7 @@ module Mutations
graphql_name 'MergeRequestSetMilestone'
argument :milestone_id,
GraphQL::ID_TYPE,
::Types::GlobalIDType[::Milestone],
required: false,
loads: Types::MilestoneType,
description: <<~DESC
......
......@@ -8,7 +8,7 @@ module Mutations
authorize :update_todo
argument :id,
GraphQL::ID_TYPE,
::Types::GlobalIDType[::Todo],
required: true,
description: 'The global id of the todo to mark as done'
......
......@@ -8,7 +8,7 @@ module Mutations
authorize :update_todo
argument :id,
GraphQL::ID_TYPE,
::Types::GlobalIDType[::Todo],
required: true,
description: 'The global id of the todo to restore'
......
......@@ -6,7 +6,7 @@ module Resolvers
type Types::BoardType, null: true
argument :id, GraphQL::ID_TYPE,
argument :id, ::Types::GlobalIDType[::Board],
required: true,
description: 'The board\'s ID'
......
......@@ -1945,7 +1945,7 @@ input BoardListUpdateLimitMetricsInput {
"""
The global ID of the list.
"""
listId: ID!
listId: ListID!
"""
The new maximum issue count limit.
......@@ -7504,7 +7504,7 @@ type Group {
"""
The board's ID
"""
id: ID!
id: BoardID!
): Board
"""
......@@ -9558,7 +9558,7 @@ input IssueSetIterationInput {
"""
The iteration to assign to the issue.
"""
iterationId: ID
iterationId: IterationID
"""
The project the issue to mutate is in
......@@ -11569,7 +11569,7 @@ input MergeRequestSetMilestoneInput {
"""
The milestone to assign to the merge request.
"""
milestoneId: ID
milestoneId: MilestoneID
"""
The project the merge request to mutate is in
......@@ -13389,7 +13389,7 @@ type Project {
"""
The board's ID
"""
id: ID!
id: BoardID!
): Board
"""
......@@ -18789,7 +18789,7 @@ input TodoMarkDoneInput {
"""
The global id of the todo to mark as done
"""
id: ID!
id: TodoID!
}
"""
......@@ -18824,7 +18824,7 @@ input TodoRestoreInput {
"""
The global id of the todo to restore
"""
id: ID!
id: TodoID!
}
"""
......
......@@ -5106,7 +5106,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "ListID",
"ofType": null
}
},
......@@ -20666,7 +20666,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "BoardID",
"ofType": null
}
},
......@@ -26103,7 +26103,7 @@
"description": "The iteration to assign to the issue.\n",
"type": {
"kind": "SCALAR",
"name": "ID",
"name": "IterationID",
"ofType": null
},
"defaultValue": null
......@@ -31753,7 +31753,7 @@
"description": "The milestone to assign to the merge request.\n",
"type": {
"kind": "SCALAR",
"name": "ID",
"name": "MilestoneID",
"ofType": null
},
"defaultValue": null
......@@ -39336,7 +39336,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "BoardID",
"ofType": null
}
},
......@@ -54608,7 +54608,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "TodoID",
"ofType": null
}
},
......@@ -54714,7 +54714,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "TodoID",
"ofType": null
}
},
......@@ -7,7 +7,7 @@ module Mutations
graphql_name 'BoardListUpdateLimitMetrics'
argument :list_id,
GraphQL::ID_TYPE,
::Types::GlobalIDType[::List],
required: true,
description: 'The global ID of the list.'
......
......@@ -6,7 +6,7 @@ module Mutations
graphql_name 'IssueSetIteration'
argument :iteration_id,
GraphQL::ID_TYPE,
::Types::GlobalIDType[::Iteration],
required: false,
loads: Types::IterationType,
description: <<~DESC
......
......@@ -37,8 +37,7 @@ RSpec.describe 'Update list limit metrics' do
it 'returns an error if the gid identifies another object' do
post_graphql_mutation(mutation('all_metrics', list_id: user.to_global_id.to_s), current_user: create(:user))
expect(graphql_errors).to include(a_hash_including('message' => "The resource that you are attempting to access does " \
"not exist or you don't have permission to perform this action"))
expect(graphql_errors).to include(a_hash_including('message' => /"#{GitlabSchema.id_from_object(user)}" does not represent an instance of List/))
end
%w[all_metrics issue_count issue_weights].each do |metric|
......
......@@ -77,14 +77,14 @@ RSpec.describe 'Marking todos done' do
context 'when using an invalid gid' do
let(:input) { { id: GitlabSchema.id_from_object(author).to_s } }
let(:invalid_gid_error) { "\"#{input[:id]}\" does not represent an instance of #{todo1.class}" }
let(:invalid_gid_error) { /"#{input[:id]}" does not represent an instance of #{todo1.class}/ }
it 'contains the expected error' do
post_graphql_mutation(mutation, current_user: current_user)
errors = json_response['errors']
expect(errors).not_to be_blank
expect(errors.first['message']).to eq(invalid_gid_error)
expect(errors.first['message']).to match(invalid_gid_error)
expect(todo1.reload.state).to eq('pending')
expect(todo2.reload.state).to eq('done')
......
......@@ -77,14 +77,14 @@ RSpec.describe 'Restoring Todos' do
context 'when using an invalid gid' do
let(:input) { { id: GitlabSchema.id_from_object(author).to_s } }
let(:invalid_gid_error) { "\"#{input[:id]}\" does not represent an instance of #{todo1.class}" }
let(:invalid_gid_error) { /"#{input[:id]}" does not represent an instance of #{todo1.class}/ }
it 'contains the expected error' do
post_graphql_mutation(mutation, current_user: current_user)
errors = json_response['errors']
expect(errors).not_to be_blank
expect(errors.first['message']).to eq(invalid_gid_error)
expect(errors.first['message']).to match(invalid_gid_error)
expect(todo1.reload.state).to eq('done')
expect(todo2.reload.state).to eq('pending')
......
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