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
...
@@ -20,56 +20,61 @@ Example response:
...
@@ -20,56 +20,61 @@ Example response:
```
json
```
json
[
[
{
{
"name"
:
"bug"
,
"id"
:
1
,
"color"
:
"#d9534f"
,
"name"
:
"bug"
,
"description"
:
"Bug reported by user"
,
"color"
:
"#d9534f"
,
"open_issues_count"
:
1
,
"description"
:
"Bug reported by user"
,
"closed_issues_count"
:
0
,
"open_issues_count"
:
1
,
"open_merge_requests_count"
:
1
,
"closed_issues_count"
:
0
,
"subscribed"
:
false
,
"open_merge_requests_count"
:
1
,
"priority"
:
10
"subscribed"
:
false
,
},
"priority"
:
10
{
},
"color"
:
"#d9534f"
,
{
"name"
:
"confirmed"
,
"id"
:
4
,
"description"
:
"Confirmed issue"
,
"color"
:
"#d9534f"
,
"open_issues_count"
:
2
,
"name"
:
"confirmed"
,
"closed_issues_count"
:
5
,
"description"
:
"Confirmed issue"
,
"open_merge_requests_count"
:
0
,
"open_issues_count"
:
2
,
"subscribed"
:
false
,
"closed_issues_count"
:
5
,
"priority"
:
null
"open_merge_requests_count"
:
0
,
},
"subscribed"
:
false
,
{
"priority"
:
null
"name"
:
"critical"
,
},
"color"
:
"#d9534f"
,
{
"description"
:
"Critical issue. Need fix ASAP"
,
"id"
:
7
,
"open_issues_count"
:
1
,
"name"
:
"critical"
,
"closed_issues_count"
:
3
,
"color"
:
"#d9534f"
,
"open_merge_requests_count"
:
1
,
"description"
:
"Critical issue. Need fix ASAP"
,
"subscribed"
:
false
,
"open_issues_count"
:
1
,
"priority"
:
null
"closed_issues_count"
:
3
,
},
"open_merge_requests_count"
:
1
,
{
"subscribed"
:
false
,
"name"
:
"documentation"
,
"priority"
:
null
"color"
:
"#f0ad4e"
,
},
"description"
:
"Issue about documentation"
,
{
"open_issues_count"
:
1
,
"id"
:
8
,
"closed_issues_count"
:
0
,
"name"
:
"documentation"
,
"open_merge_requests_count"
:
2
,
"color"
:
"#f0ad4e"
,
"subscribed"
:
false
,
"description"
:
"Issue about documentation"
,
"priority"
:
null
"open_issues_count"
:
1
,
},
"closed_issues_count"
:
0
,
{
"open_merge_requests_count"
:
2
,
"color"
:
"#5cb85c"
,
"subscribed"
:
false
,
"name"
:
"enhancement"
,
"priority"
:
null
"description"
:
"Enhancement proposal"
,
},
"open_issues_count"
:
1
,
{
"closed_issues_count"
:
0
,
"id"
:
9
,
"open_merge_requests_count"
:
1
,
"color"
:
"#5cb85c"
,
"subscribed"
:
false
,
"name"
:
"enhancement"
,
"priority"
:
null
"description"
:
"Enhancement proposal"
,
}
"open_issues_count"
:
1
,
"closed_issues_count"
:
0
,
"open_merge_requests_count"
:
1
,
"subscribed"
:
true
,
"priority"
:
null
}
]
]
```
```
...
@@ -100,13 +105,15 @@ Example response:
...
@@ -100,13 +105,15 @@ Example response:
```
json
```
json
{
{
"name"
:
"feature"
,
"id"
:
10
,
"color"
:
"#5843AD"
,
"name"
:
"feature"
,
"open_issues_count"
:
1
,
"color"
:
"#5843AD"
,
"closed_issues_count"
:
0
,
"description"
:
null
,
"open_merge_requests_count"
:
1
,
"open_issues_count"
:
0
,
"description"
:
null
,
"closed_issues_count"
:
0
,
"priority"
:
null
"open_merge_requests_count"
:
0
,
"subscribed"
:
false
,
"priority"
:
null
}
}
```
```
...
@@ -135,15 +142,15 @@ Example response:
...
@@ -135,15 +142,15 @@ Example response:
```
json
```
json
{
{
"title"
:
"feature"
,
"id"
:
1
,
"color"
:
"#5843AD
"
,
"name"
:
"bug
"
,
"description"
:
"New feature proposal
"
,
"color"
:
"#d9534f
"
,
"updated_at"
:
"2015-11-03T21:22:30.737Z
"
,
"description"
:
"Bug reported by user
"
,
"template"
:
false
,
"open_issues_count"
:
1
,
"project_id"
:
1
,
"closed_issues_count"
:
0
,
"created_at"
:
"2015-11-03T21:22:30.737Z"
,
"open_merge_requests_count"
:
1
,
"id"
:
9
,
"subscribed"
:
false
,
"priority"
:
null
"priority"
:
null
}
}
```
```
...
@@ -178,13 +185,15 @@ Example response:
...
@@ -178,13 +185,15 @@ Example response:
```
json
```
json
{
{
"color"
:
"#8E44AD"
,
"id"
:
8
,
"name"
:
"docs"
,
"name"
:
"docs"
,
"description"
:
"Documentation"
,
"color"
:
"#8E44AD"
,
"open_issues_count"
:
1
,
"description"
:
"Documentation"
,
"closed_issues_count"
:
0
,
"open_issues_count"
:
1
,
"open_merge_requests_count"
:
1
,
"closed_issues_count"
:
0
,
"priority"
:
null
"open_merge_requests_count"
:
2
,
"subscribed"
:
false
,
"priority"
:
null
}
}
```
```
...
@@ -213,14 +222,15 @@ Example response:
...
@@ -213,14 +222,15 @@ Example response:
```
json
```
json
{
{
"name"
:
"Docs"
,
"id"
:
1
,
"color"
:
"#cc0033"
,
"name"
:
"bug"
,
"description"
:
""
,
"color"
:
"#d9534f"
,
"open_issues_count"
:
0
,
"description"
:
"Bug reported by user"
,
"closed_issues_count"
:
0
,
"open_issues_count"
:
1
,
"open_merge_requests_count"
:
0
,
"closed_issues_count"
:
0
,
"subscribed"
:
true
,
"open_merge_requests_count"
:
1
,
"priority"
:
null
"subscribed"
:
true
,
"priority"
:
null
}
}
```
```
...
@@ -249,13 +259,14 @@ Example response:
...
@@ -249,13 +259,14 @@ Example response:
```
json
```
json
{
{
"name"
:
"Docs"
,
"id"
:
1
,
"color"
:
"#cc0033"
,
"name"
:
"bug"
,
"description"
:
""
,
"color"
:
"#d9534f"
,
"open_issues_count"
:
0
,
"description"
:
"Bug reported by user"
,
"closed_issues_count"
:
0
,
"open_issues_count"
:
1
,
"open_merge_requests_count"
:
0
,
"closed_issues_count"
:
0
,
"subscribed"
:
false
,
"open_merge_requests_count"
:
1
,
"priority"
:
null
"subscribed"
:
false
,
"priority"
:
null
}
}
```
```
lib/api/entities.rb
浏览文件 @
93f4234d
...
@@ -433,7 +433,7 @@ module API
...
@@ -433,7 +433,7 @@ module API
end
end
class
LabelBasic
<
Grape
::
Entity
class
LabelBasic
<
Grape
::
Entity
expose
:name
,
:color
,
:description
expose
:
id
,
:
name
,
:color
,
:description
end
end
class
Label
<
LabelBasic
class
Label
<
LabelBasic
...
...
spec/requests/api/labels_spec.rb
浏览文件 @
93f4234d
...
@@ -17,12 +17,18 @@ describe API::API, api: true do
...
@@ -17,12 +17,18 @@ describe API::API, api: true do
group
=
create
(
:group
)
group
=
create
(
:group
)
group_label
=
create
(
:group_label
,
group:
group
)
group_label
=
create
(
:group_label
,
group:
group
)
project
.
update
(
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
)
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
3
)
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
.
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
[
'name'
]).
to
eq
(
label1
.
name
)
expect
(
json_response
.
last
[
'color'
]).
to
be_present
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录