Commit 0e09fdc9 authored by Valery Sizov's avatar Valery Sizov

[Multiple issue assignees] fix v4 API for issues

parent 4a35d4b6
...@@ -40,7 +40,7 @@ module IssuableCollections ...@@ -40,7 +40,7 @@ module IssuableCollections
end end
def issues_collection def issues_collection
issues_finder.execute.preload(:project, :author, :labels, :milestone, :assignees, project: :namespace) issues_finder.execute.preload(:project, :author, :assignees, :labels, :milestone, project: :namespace)
end end
def merge_requests_collection def merge_requests_collection
......
...@@ -31,7 +31,7 @@ module API ...@@ -31,7 +31,7 @@ module API
params :issue_params do params :issue_params do
optional :description, type: String, desc: 'The description of an issue' optional :description, type: String, desc: 'The description of an issue'
optional :assignee_id, type: Integer, desc: 'The ID of a user to assign issue' optional :assignee_ids, type: Array[Integer], desc: 'The ID of a user to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue' optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue'
optional :labels, type: String, desc: 'Comma-separated list of label names' optional :labels, type: String, desc: 'Comma-separated list of label names'
optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY' optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
...@@ -156,7 +156,7 @@ module API ...@@ -156,7 +156,7 @@ module API
desc: 'Date time when the issue was updated. Available only for admins and project owners.' desc: 'Date time when the issue was updated. Available only for admins and project owners.'
optional :state_event, type: String, values: %w[reopen close], desc: 'State of the issue' optional :state_event, type: String, values: %w[reopen close], desc: 'State of the issue'
use :issue_params use :issue_params
at_least_one_of :title, :description, :assignee_id, :milestone_id, at_least_one_of :title, :description, :assignee_ids, :milestone_id,
:labels, :created_at, :due_date, :confidential, :state_event, :labels, :created_at, :due_date, :confidential, :state_event,
:weight :weight
end end
......
...@@ -33,17 +33,20 @@ ...@@ -33,17 +33,20 @@
}, },
"additionalProperties": false "additionalProperties": false
}, },
"assignee": { "assignees": {
"type": ["object", "null"], "type": "array",
"properties": { "items": {
"name": { "type": "string" }, "type": ["object", "null"],
"username": { "type": "string" }, "properties": {
"id": { "type": "integer" }, "name": { "type": "string" },
"state": { "type": "string" }, "username": { "type": "string" },
"avatar_url": { "type": "uri" }, "id": { "type": "integer" },
"web_url": { "type": "uri" } "state": { "type": "string" },
}, "avatar_url": { "type": "uri" },
"additionalProperties": false "web_url": { "type": "uri" }
},
"additionalProperties": false
}
}, },
"author": { "author": {
"type": "object", "type": "object",
...@@ -68,7 +71,7 @@ ...@@ -68,7 +71,7 @@
"required": [ "required": [
"id", "iid", "project_id", "title", "description", "id", "iid", "project_id", "title", "description",
"state", "created_at", "updated_at", "labels", "state", "created_at", "updated_at", "labels",
"milestone", "assignee", "author", "user_notes_count", "milestone", "assignees", "author", "user_notes_count",
"upvotes", "downvotes", "due_date", "confidential", "upvotes", "downvotes", "due_date", "confidential",
"web_url", "weight" "web_url", "weight"
], ],
......
...@@ -788,7 +788,7 @@ describe API::Issues, api: true do ...@@ -788,7 +788,7 @@ describe API::Issues, api: true do
expect(json_response['updated_at']).to be_present expect(json_response['updated_at']).to be_present
expect(json_response['labels']).to eq(issue.label_names) expect(json_response['labels']).to eq(issue.label_names)
expect(json_response['milestone']).to be_a Hash expect(json_response['milestone']).to be_a Hash
expect(json_response['assignee']).to be_a Hash expect(json_response['assignees']).to be_a Array
expect(json_response['author']).to be_a Hash expect(json_response['author']).to be_a Hash
expect(json_response['confidential']).to be_falsy expect(json_response['confidential']).to be_falsy
expect(json_response['weight']).to be_nil expect(json_response['weight']).to be_nil
......
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