Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
93f4234d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
93f4234d
编写于
11月 07, 2016
作者:
S
Sean McGivern
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'add-api-label-id' into 'master'
Expose Label id to API Closes #23448 See merge request !7275
上级
6f307295
63f0b099
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
111 addition
and
90 deletion
+111
-90
changelogs/unreleased/add-api-label-id.yml
changelogs/unreleased/add-api-label-id.yml
+4
-0
doc/api/labels.md
doc/api/labels.md
+100
-89
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+6
-0
未找到文件。
changelogs/unreleased/add-api-label-id.yml
0 → 100644
浏览文件 @
93f4234d
---
title
:
Expose label IDs in API
merge_request
:
7275
author
:
Rares Sfirlogea
doc/api/labels.md
浏览文件 @
93f4234d
...
...
@@ -21,6 +21,7 @@ Example response:
```
json
[
{
"id"
:
1
,
"name"
:
"bug"
,
"color"
:
"#d9534f"
,
"description"
:
"Bug reported by user"
,
...
...
@@ -31,6 +32,7 @@ Example response:
"priority"
:
10
},
{
"id"
:
4
,
"color"
:
"#d9534f"
,
"name"
:
"confirmed"
,
"description"
:
"Confirmed issue"
,
...
...
@@ -41,6 +43,7 @@ Example response:
"priority"
:
null
},
{
"id"
:
7
,
"name"
:
"critical"
,
"color"
:
"#d9534f"
,
"description"
:
"Critical issue. Need fix ASAP"
,
...
...
@@ -51,6 +54,7 @@ Example response:
"priority"
:
null
},
{
"id"
:
8
,
"name"
:
"documentation"
,
"color"
:
"#f0ad4e"
,
"description"
:
"Issue about documentation"
,
...
...
@@ -61,13 +65,14 @@ Example response:
"priority"
:
null
},
{
"id"
:
9
,
"color"
:
"#5cb85c"
,
"name"
:
"enhancement"
,
"description"
:
"Enhancement proposal"
,
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
1
,
"subscribed"
:
fals
e
,
"subscribed"
:
tru
e
,
"priority"
:
null
}
]
...
...
@@ -100,12 +105,14 @@ Example response:
```
json
{
"id"
:
10
,
"name"
:
"feature"
,
"color"
:
"#5843AD"
,
"open_issues_count"
:
1
,
"description"
:
null
,
"open_issues_count"
:
0
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
1
,
"description"
:
null
,
"open_merge_requests_count"
:
0
,
"subscribed"
:
false
,
"priority"
:
null
}
```
...
...
@@ -135,14 +142,14 @@ Example response:
```
json
{
"title"
:
"feature"
,
"color"
:
"#5843AD
"
,
"description"
:
"New feature proposal
"
,
"updated_at"
:
"2015-11-03T21:22:30.737Z
"
,
"template"
:
false
,
"project_id"
:
1
,
"created_at"
:
"2015-11-03T21:22:30.737Z"
,
"id"
:
9
,
"id"
:
1
,
"name"
:
"bug
"
,
"color"
:
"#d9534f
"
,
"description"
:
"Bug reported by user
"
,
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
1
,
"subscribed"
:
false
,
"priority"
:
null
}
```
...
...
@@ -178,12 +185,14 @@ Example response:
```
json
{
"color"
:
"#8E44AD"
,
"id"
:
8
,
"name"
:
"docs"
,
"color"
:
"#8E44AD"
,
"description"
:
"Documentation"
,
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
1
,
"open_merge_requests_count"
:
2
,
"subscribed"
:
false
,
"priority"
:
null
}
```
...
...
@@ -213,12 +222,13 @@ Example response:
```
json
{
"name"
:
"Docs"
,
"color"
:
"#cc0033"
,
"description"
:
""
,
"open_issues_count"
:
0
,
"id"
:
1
,
"name"
:
"bug"
,
"color"
:
"#d9534f"
,
"description"
:
"Bug reported by user"
,
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
0
,
"open_merge_requests_count"
:
1
,
"subscribed"
:
true
,
"priority"
:
null
}
...
...
@@ -249,12 +259,13 @@ Example response:
```
json
{
"name"
:
"Docs"
,
"color"
:
"#cc0033"
,
"description"
:
""
,
"open_issues_count"
:
0
,
"id"
:
1
,
"name"
:
"bug"
,
"color"
:
"#d9534f"
,
"description"
:
"Bug reported by user"
,
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
0
,
"open_merge_requests_count"
:
1
,
"subscribed"
:
false
,
"priority"
:
null
}
...
...
lib/api/entities.rb
浏览文件 @
93f4234d
...
...
@@ -433,7 +433,7 @@ module API
end
class
LabelBasic
<
Grape
::
Entity
expose
:name
,
:color
,
:description
expose
:
id
,
:
name
,
:color
,
:description
end
class
Label
<
LabelBasic
...
...
spec/requests/api/labels_spec.rb
浏览文件 @
93f4234d
...
...
@@ -17,12 +17,18 @@ describe API::API, api: true do
group
=
create
(
:group
)
group_label
=
create
(
:group_label
,
group:
group
)
project
.
update
(
group:
group
)
expected_keys
=
[
'id'
,
'name'
,
'color'
,
'description'
,
'open_issues_count'
,
'closed_issues_count'
,
'open_merge_requests_count'
,
'subscribed'
,
'priority'
]
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
3
)
expect
(
json_response
.
first
.
keys
).
to
match_array
expected_keys
expect
(
json_response
.
map
{
|
l
|
l
[
'name'
]
}).
to
match_array
([
group_label
.
name
,
priority_label
.
name
,
label1
.
name
])
expect
(
json_response
.
last
[
'name'
]).
to
eq
(
label1
.
name
)
expect
(
json_response
.
last
[
'color'
]).
to
be_present
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录