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
876bf723
Commit
876bf723
authored
Jan 05, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update update epic API endpoint response
parent
2cedef01
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
6 deletions
+116
-6
doc/api/epic_issues.md
doc/api/epic_issues.md
+97
-0
ee/lib/api/epic_issues.rb
ee/lib/api/epic_issues.rb
+7
-1
lib/api/entities.rb
lib/api/entities.rb
+2
-0
spec/ee/fixtures/api/schemas/public_api/v4/epic_issue_link.json
...e/fixtures/api/schemas/public_api/v4/epic_issue_link.json
+2
-1
spec/ee/fixtures/api/schemas/public_api/v4/epic_issues.json
spec/ee/fixtures/api/schemas/public_api/v4/epic_issues.json
+4
-3
spec/ee/spec/requests/api/epic_issues_spec.rb
spec/ee/spec/requests/api/epic_issues_spec.rb
+4
-1
No files found.
doc/api/epic_issues.md
View file @
876bf723
...
...
@@ -312,3 +312,100 @@ Example response:
```
**Note**
:
`assignee`
column is deprecated, now we show it as a single-sized array
`assignees`
to conform to the GitLab EE API.
## Update epic - issue association
Updates an epic - issue association.
```
PUT /groups/:id/-/epics/:epic_iid/issues/:epic_issue_id
```
| Attribute | Type | Required | Description |
| ------------------- | ---------------- | ---------- | -----------------------------------------------------------------------------------------------------|
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the group
](
README.md#namespaced-path-encoding
)
owned by the authenticated user |
|
`epic_iid`
| integer/string | yes | The internal ID of the epic. |
|
`epic_issue_id`
| integer/string | yes | The ID of the issue - epic association. |
|
`move_before_id`
| integer/string | no | The ID of the issue - epic association that should be placed before the link in the question. |
|
`move_after_id`
| integer/string | no | The ID of the issue - epic association that should be placed after the link in the question. |
```
bash
curl
--header
PUT
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/groups/1/-/epics/5/issues/11?move_before_id
=
20
```
Example response:
```
json
[
{
"id"
:
30
,
"iid"
:
6
,
"project_id"
:
8
,
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"description"
:
"Ratione dolores corrupti mollitia soluta quia."
,
"state"
:
"opened"
,
"created_at"
:
"2017-11-15T13:39:24.670Z"
,
"updated_at"
:
"2018-01-04T10:49:19.506Z"
,
"closed_at"
:
null
,
"labels"
:
[],
"milestone"
:
{
"id"
:
38
,
"iid"
:
3
,
"project_id"
:
8
,
"title"
:
"v2.0"
,
"description"
:
"In tempore culpa inventore quo accusantium."
,
"state"
:
"closed"
,
"created_at"
:
"2017-11-15T13:39:13.825Z"
,
"updated_at"
:
"2017-11-15T13:39:13.825Z"
,
"due_date"
:
null
,
"start_date"
:
null
},
"assignees"
:
[{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/arnita"
}],
"assignee"
:
{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/arnita"
},
"author"
:
{
"id"
:
13
,
"name"
:
"Michell Johns"
,
"username"
:
"chris_hahn"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/30e3b2122ccd6b8e45e8e14a3ffb58fc?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/chris_hahn"
},
"user_notes_count"
:
8
,
"upvotes"
:
0
,
"downvotes"
:
0
,
"due_date"
:
null
,
"confidential"
:
false
,
"weight"
:
null
,
"discussion_locked"
:
null
,
"web_url"
:
"http://localhost:3001/h5bp/html5-boilerplate/issues/6"
,
"time_stats"
:
{
"time_estimate"
:
0
,
"total_time_spent"
:
0
,
"human_time_estimate"
:
null
,
"human_total_time_spent"
:
null
},
"_links"
:{
"self"
:
"http://localhost:3001/api/v4/projects/8/issues/6"
,
"notes"
:
"http://localhost:3001/api/v4/projects/8/issues/6/notes"
,
"award_emoji"
:
"http://localhost:3001/api/v4/projects/8/issues/6/award_emoji"
,
"project"
:
"http://localhost:3001/api/v4/projects/8"
},
"subscribed"
:
true
,
"epic_issue_id"
:
11
,
"relative_position"
:
55
}
]
ee/lib/api/epic_issues.rb
View file @
876bf723
...
...
@@ -52,7 +52,13 @@ module API
# For now we return empty body
# The issues list in the correct order in body will be returned as part of #4250
render_api_error!
({
error:
"Issue could not be moved!"
},
400
)
unless
result
if
result
present
epic
.
issues
(
current_user
),
with:
Entities
::
EpicIssue
,
current_user:
current_user
else
render_api_error!
({
error:
"Issue could not be moved!"
},
400
)
end
end
desc
'Get issues assigned to the epic'
do
...
...
lib/api/entities.rb
View file @
876bf723
...
...
@@ -503,10 +503,12 @@ module API
class
EpicIssue
<
Issue
expose
:epic_issue_id
expose
:relative_position
end
class
EpicIssueLink
<
Grape
::
Entity
expose
:id
expose
:relative_position
expose
:epic
,
using:
Entities
::
Epic
expose
:issue
,
using:
Entities
::
IssueBasic
end
...
...
spec/ee/fixtures/api/schemas/public_api/v4/epic_issue_link.json
View file @
876bf723
...
...
@@ -2,6 +2,7 @@
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"relative_position"
:
{
"type"
:
"integer"
},
"issue"
:
{
"type"
:
"object"
},
"epic"
:
{
"type"
:
"object"
,
...
...
@@ -32,6 +33,6 @@
]
}
},
"required"
:
[
"id"
,
"epic"
,
"issue"
],
"required"
:
[
"id"
,
"epic"
,
"issue"
,
"relative_position"
],
"additionalProperties"
:
false
}
spec/ee/fixtures/api/schemas/public_api/v4/epic_issues.json
View file @
876bf723
...
...
@@ -3,9 +3,10 @@
{
"$ref"
:
"./issues.json"
},
{
"properties"
:
{
"
issue_link_id"
:
{
"type"
:
[
"integer"
,
"null
"
]
},
"
position"
:
{
"type"
:
[
"integer"
,
"null
"
]
}
"
epic_issue_id"
:
{
"type"
:
[
"integer
"
]
},
"
relative_position"
:
{
"type"
:
[
"integer
"
]
}
}
}
]
],
"additionalProperties"
:
false
}
spec/ee/spec/requests/api/epic_issues_spec.rb
View file @
876bf723
...
...
@@ -295,8 +295,11 @@ describe API::EpicIssues do
it
'updates the positions values'
do
expect
(
epic_issue1
.
reload
.
relative_position
).
to
be
<
epic_issue2
.
relative_position
end
it
'matches the response schema'
do
expect
(
response
).
to
match_response_schema
(
'public_api/v4/epic_issues'
,
dir:
'ee'
)
end
end
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