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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
199a4db2
Commit
199a4db2
authored
Nov 30, 2018
by
Heinrich Lee Yu
Committed by
Heinrich Lee Yu
Dec 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add schema tests
parent
ddb1d326
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
178 additions
and
51 deletions
+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
No files found.
app/serializers/issuable_sidebar_entity.rb
View file @
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
View file @
199a4db2
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"delete_path"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/entities/issue_sidebar.json
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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'
}
...
...
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