Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
199a4db2
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,发现更多精彩内容 >>
提交
199a4db2
编写于
11月 30, 2018
作者:
H
Heinrich Lee Yu
提交者:
Heinrich Lee Yu
12月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add schema tests
上级
ddb1d326
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
178 addition
and
51 deletion
+178
-51
app/serializers/issuable_sidebar_entity.rb
app/serializers/issuable_sidebar_entity.rb
+1
-1
spec/fixtures/api/schemas/entities/issuable_sidebar_todo.json
.../fixtures/api/schemas/entities/issuable_sidebar_todo.json
+8
-0
spec/fixtures/api/schemas/entities/issue_sidebar.json
spec/fixtures/api/schemas/entities/issue_sidebar.json
+43
-14
spec/fixtures/api/schemas/entities/issue_sidebar_extras.json
spec/fixtures/api/schemas/entities/issue_sidebar_extras.json
+18
-0
spec/fixtures/api/schemas/entities/merge_request_sidebar.json
.../fixtures/api/schemas/entities/merge_request_sidebar.json
+44
-12
spec/fixtures/api/schemas/entities/merge_request_sidebar_extras.json
...es/api/schemas/entities/merge_request_sidebar_extras.json
+21
-0
spec/fixtures/api/schemas/public_api/v4/milestone.json
spec/fixtures/api/schemas/public_api/v4/milestone.json
+22
-0
spec/fixtures/api/schemas/public_api/v4/milestones.json
spec/fixtures/api/schemas/public_api/v4/milestones.json
+1
-20
spec/serializers/issue_serializer_spec.rb
spec/serializers/issue_serializer_spec.rb
+10
-2
spec/serializers/merge_request_serializer_spec.rb
spec/serializers/merge_request_serializer_spec.rb
+10
-2
未找到文件。
app/serializers/issuable_sidebar_entity.rb
浏览文件 @
199a4db2
...
...
@@ -12,7 +12,7 @@ class IssuableSidebarEntity < Grape::Entity
expose
:project_id
do
|
issuable
|
issuable
.
project
.
id
end
expose
:discussion_locked
?
,
as: :discussion_locked
expose
:discussion_locked
expose
:reference
do
|
issuable
|
issuable
.
to_reference
(
issuable
.
project
,
full:
true
)
end
...
...
spec/fixtures/api/schemas/entities/issuable_sidebar_todo.json
0 → 100644
浏览文件 @
199a4db2
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"delete_path"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/entities/issue_sidebar.json
浏览文件 @
199a4db2
...
...
@@ -2,20 +2,49 @@
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"subscribed"
:
{
"type"
:
"boolean"
},
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"participants"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
"type"
:
{
"type"
:
"string"
},
"author_id"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
"integer"
},
"discussion_locked"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"due_date"
:
{
"type"
:
"date"
},
"confidential"
:
{
"type"
:
"boolean"
},
"reference"
:
{
"type"
:
"string"
},
"current_user"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"user.json"
}
]
},
"todo"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"issuable_sidebar_todo.json"
}
]
},
"milestone"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"../public_api/v4/milestone.json"
}
]
},
"
assignee
s"
:
{
"
label
s"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
}
"items"
:
{
"$ref"
:
"label.json"
}
},
"additionalProperties"
:
false
"signed_in"
:
{
"type"
:
"boolean"
},
"can_edit"
:
{
"type"
:
"boolean"
},
"can_move"
:
{
"type"
:
"boolean"
},
"can_admin_label"
:
{
"type"
:
"boolean"
},
"issuable_json_path"
:
{
"type"
:
"string"
},
"namespace_path"
:
{
"type"
:
"string"
},
"project_path"
:
{
"type"
:
"string"
},
"project_full_path"
:
{
"type"
:
"string"
},
"project_issuables_path"
:
{
"type"
:
"string"
},
"create_todo_path"
:
{
"type"
:
"string"
},
"project_milestones_path"
:
{
"type"
:
"string"
},
"project_labels_path"
:
{
"type"
:
"string"
},
"toggle_subscription_path"
:
{
"type"
:
"string"
},
"move_issue_path"
:
{
"type"
:
"string"
},
"projects_autocomplete_path"
:
{
"type"
:
"string"
}
}
}
spec/fixtures/api/schemas/entities/issue_sidebar_extras.json
0 → 100644
浏览文件 @
199a4db2
{
"type"
:
"object"
,
"properties"
:
{
"subscribed"
:
{
"type"
:
"boolean"
},
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"participants"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
},
"assignees"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
}
}
}
spec/fixtures/api/schemas/entities/merge_request_sidebar.json
浏览文件 @
199a4db2
...
...
@@ -2,20 +2,52 @@
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"subscribed"
:
{
"type"
:
"boolean"
},
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"participants"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
"type"
:
{
"type"
:
"string"
},
"author_id"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
"integer"
},
"discussion_locked"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"reference"
:
{
"type"
:
"string"
},
"current_user"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"user.json"
}
]
},
"todo"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"issuable_sidebar_todo.json"
}
]
},
"milestone"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"../public_api/v4/milestones.json"
}
]
},
"
assignee
s"
:
{
"
label
s"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
}
"items"
:
{
"$ref"
:
"label.json"
}
},
"assignee"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
},
"signed_in"
:
{
"type"
:
"boolean"
},
"can_edit"
:
{
"type"
:
"boolean"
},
"can_move"
:
{
"type"
:
"boolean"
},
"can_admin_label"
:
{
"type"
:
"boolean"
},
"can_merge"
:
{
"type"
:
[
"boolean"
,
"null"
]
},
"issuable_json_path"
:
{
"type"
:
"string"
},
"namespace_path"
:
{
"type"
:
"string"
},
"project_path"
:
{
"type"
:
"string"
},
"project_full_path"
:
{
"type"
:
"string"
},
"project_issuables_path"
:
{
"type"
:
"string"
},
"create_todo_path"
:
{
"type"
:
"string"
},
"project_milestones_path"
:
{
"type"
:
"string"
},
"project_labels_path"
:
{
"type"
:
"string"
},
"toggle_subscription_path"
:
{
"type"
:
"string"
},
"move_issue_path"
:
{
"type"
:
"string"
},
"projects_autocomplete_path"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/entities/merge_request_sidebar_extras.json
0 → 100644
浏览文件 @
199a4db2
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"subscribed"
:
{
"type"
:
"boolean"
},
"time_estimate"
:
{
"type"
:
"integer"
},
"total_time_spent"
:
{
"type"
:
"integer"
},
"human_time_estimate"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"human_total_time_spent"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"participants"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
},
"assignees"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"../public_api/v4/user/basic.json"
}
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/public_api/v4/milestone.json
0 → 100644
浏览文件 @
199a4db2
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"group_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"start_date"
:
{
"type"
:
"date"
},
"due_date"
:
{
"type"
:
"date"
},
"web_url"
:
{
"type"
:
"string"
}
},
"required"
:
[
"id"
,
"iid"
,
"title"
,
"description"
,
"state"
,
"state"
,
"created_at"
,
"updated_at"
,
"start_date"
,
"due_date"
],
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/public_api/v4/milestones.json
浏览文件 @
199a4db2
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"project_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"group_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"state"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"start_date"
:
{
"type"
:
"date"
},
"due_date"
:
{
"type"
:
"date"
},
"web_url"
:
{
"type"
:
"string"
}
},
"required"
:
[
"id"
,
"iid"
,
"title"
,
"description"
,
"state"
,
"state"
,
"created_at"
,
"updated_at"
,
"start_date"
,
"due_date"
],
"additionalProperties"
:
false
"$ref"
:
"./milestone.json"
}
}
spec/serializers/issue_serializer_spec.rb
浏览文件 @
199a4db2
...
...
@@ -18,13 +18,21 @@ describe IssueSerializer do
end
context
'sidebar issue serialization'
do
let
(
:serializer
)
{
'sidebar
_extras
'
}
let
(
:serializer
)
{
'sidebar'
}
it
'matches
sidebar issue
json schema'
do
it
'matches
issue_sidebar
json schema'
do
expect
(
json_entity
).
to
match_schema
(
'entities/issue_sidebar'
)
end
end
context
'sidebar extras issue serialization'
do
let
(
:serializer
)
{
'sidebar_extras'
}
it
'matches issue_sidebar_extras json schema'
do
expect
(
json_entity
).
to
match_schema
(
'entities/issue_sidebar_extras'
)
end
end
context
'board issue serialization'
do
let
(
:serializer
)
{
'board'
}
...
...
spec/serializers/merge_request_serializer_spec.rb
浏览文件 @
199a4db2
...
...
@@ -18,13 +18,21 @@ describe MergeRequestSerializer do
end
context
'sidebar merge request serialization'
do
let
(
:serializer
)
{
'sidebar
_extras
'
}
let
(
:serializer
)
{
'sidebar'
}
it
'matches
sidebar merge request
json schema'
do
it
'matches
merge_request_sidebar
json schema'
do
expect
(
json_entity
).
to
match_schema
(
'entities/merge_request_sidebar'
)
end
end
context
'sidebar_extras merge request serialization'
do
let
(
:serializer
)
{
'sidebar_extras'
}
it
'matches merge_request_sidebar_extras json schema'
do
expect
(
json_entity
).
to
match_schema
(
'entities/merge_request_sidebar_extras'
)
end
end
context
'basic merge request serialization'
do
let
(
:serializer
)
{
'basic'
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录