Commit 7078ab9e authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Render source_issue and target_issue resources with issue entity instead returning IDs

parent 3e38d6a5
......@@ -70,9 +70,66 @@ POST /projects/:id/issues/:issue_iid/links
```json
{
"id": 1,
"source_issue_id": 2,
"target_issue_id": 3
"source_issue" : {
"id" : 83,
"iid" : 11,
"project_id" : 4,
"created_at" : "2016-01-07T12:44:33.959Z",
"title" : "Issues with auth",
"state" : "opened",
"assignees" : [],
"assignee" : null,
"labels" : [
"bug"
],
"author" : {
"name" : "Alexandra Bashirian",
"avatar_url" : null,
"state" : "active",
"web_url" : "https://gitlab.example.com/eileen.lowe",
"id" : 18,
"username" : "eileen.lowe"
},
"description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null,
"subscribed" : true,
"user_notes_count": 0,
"due_date": null,
"web_url": "http://example.com/example/example/issues/11",
"confidential": false,
"weight": null,
},
"target_issue" : {
"id" : 84,
"iid" : 14,
"project_id" : 4,
"created_at" : "2016-01-07T12:44:33.959Z",
"title" : "Issues with auth",
"state" : "opened",
"assignees" : [],
"assignee" : null,
"labels" : [
"bug"
],
"author" : {
"name" : "Alexandra Bashirian",
"avatar_url" : null,
"state" : "active",
"web_url" : "https://gitlab.example.com/eileen.lowe",
"id" : 18,
"username" : "eileen.lowe"
},
"description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null,
"subscribed" : true,
"user_notes_count": 0,
"due_date": null,
"web_url": "http://example.com/example/example/issues/14",
"confidential": false,
"weight": null,
}
}
```
......@@ -94,9 +151,65 @@ DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id
```json
{
"id": 1,
"source_issue_id": 2,
"target_issue_id": 3
"source_issue" : {
"id" : 83,
"iid" : 11,
"project_id" : 4,
"created_at" : "2016-01-07T12:44:33.959Z",
"title" : "Issues with auth",
"state" : "opened",
"assignees" : [],
"assignee" : null,
"labels" : [
"bug"
],
"author" : {
"name" : "Alexandra Bashirian",
"avatar_url" : null,
"state" : "active",
"web_url" : "https://gitlab.example.com/eileen.lowe",
"id" : 18,
"username" : "eileen.lowe"
},
"description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null,
"subscribed" : true,
"user_notes_count": 0,
"due_date": null,
"web_url": "http://example.com/example/example/issues/11",
"confidential": false,
"weight": null,
},
"target_issue" : {
"id" : 84,
"iid" : 14,
"project_id" : 4,
"created_at" : "2016-01-07T12:44:33.959Z",
"title" : "Issues with auth",
"state" : "opened",
"assignees" : [],
"assignee" : null,
"labels" : [
"bug"
],
"author" : {
"name" : "Alexandra Bashirian",
"avatar_url" : null,
"state" : "active",
"web_url" : "https://gitlab.example.com/eileen.lowe",
"id" : 18,
"username" : "eileen.lowe"
},
"description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null,
"subscribed" : true,
"user_notes_count": 0,
"due_date": null,
"web_url": "http://example.com/example/example/issues/14",
"confidential": false,
"weight": null,
}
}
```
......@@ -325,9 +325,8 @@ module API
end
class IssueLink < Grape::Entity
expose :id
expose :source_id, as: :source_issue_id
expose :target_id, as: :target_issue_id
expose :source, as: :source_issue, using: Entities::IssueBasic
expose :target, as: :target_issue, using: Entities::IssueBasic
end
class IssuableTimeStats < Grape::Entity
......
......@@ -119,7 +119,7 @@ describe API::IssueLinks do
target_project_id: project.id, target_issue_iid: target_issue.iid
expect(response).to have_http_status(201)
expect(json_response).to include('id', 'source_issue_id', 'target_issue_id')
expect(json_response).to include('source_issue', 'target_issue')
end
it 'returns 201 when sending full path of target project' do
......@@ -130,7 +130,7 @@ describe API::IssueLinks do
target_project_id: project.to_reference(full: true), target_issue_iid: target_issue.iid
expect(response).to have_http_status(201)
expect(json_response).to include('id', 'source_issue_id', 'target_issue_id')
expect(json_response).to include('source_issue', 'target_issue')
end
end
end
......@@ -193,7 +193,7 @@ describe API::IssueLinks do
delete api("/projects/#{project.id}/issues/#{issue.iid}/links/#{issue_link.id}", user)
expect(response).to have_http_status(200)
expect(json_response).to include('id', 'source_issue_id', 'target_issue_id')
expect(json_response).to include('source_issue', 'target_issue')
end
end
end
......
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