Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7078ab9e
Commit
7078ab9e
authored
Jun 21, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render source_issue and target_issue resources with issue entity instead returning IDs
parent
3e38d6a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
13 deletions
+125
-13
doc/api/issue_links.md
doc/api/issue_links.md
+120
-7
lib/api/entities.rb
lib/api/entities.rb
+2
-3
spec/requests/api/issue_links_spec.rb
spec/requests/api/issue_links_spec.rb
+3
-3
No files found.
doc/api/issue_links.md
View file @
7078ab9e
...
...
@@ -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
,
}
}
```
lib/api/entities.rb
View file @
7078ab9e
...
...
@@ -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
...
...
spec/requests/api/issue_links_spec.rb
View file @
7078ab9e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment