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
b1127d7d
Commit
b1127d7d
authored
7 years ago
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose board project and milestone on boards API
parent
d7ac635b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
8 deletions
+93
-8
lib/api/entities.rb
lib/api/entities.rb
+3
-0
spec/fixtures/api/schemas/public_api/v4/board.json
spec/fixtures/api/schemas/public_api/v4/board.json
+83
-0
spec/fixtures/api/schemas/public_api/v4/boards.json
spec/fixtures/api/schemas/public_api/v4/boards.json
+4
-0
spec/requests/api/boards_spec.rb
spec/requests/api/boards_spec.rb
+3
-8
No files found.
lib/api/entities.rb
View file @
b1127d7d
...
...
@@ -567,6 +567,9 @@ module API
class
Board
<
Grape
::
Entity
expose
:id
expose
:name
expose
:project
,
using:
Entities
::
BasicProjectDetails
expose
:milestone
expose
:lists
,
using:
Entities
::
List
do
|
board
|
board
.
lists
.
destroyable
end
...
...
This diff is collapsed.
Click to expand it.
spec/fixtures/api/schemas/public_api/v4/board.json
0 → 100644
View file @
b1127d7d
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"name"
,
"project"
,
"milestone"
,
"lists"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"project"
:
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"name"
,
"name_with_namespace"
,
"path"
,
"path_with_namespace"
,
"http_url_to_repo"
,
"web_url"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"name_with_namespace"
:
{
"type"
:
"string"
},
"path"
:
{
"type"
:
"string"
},
"path_with_namespace"
:
{
"type"
:
"string"
},
"http_url_to_repo"
:
{
"type"
:
"string"
},
"web_url"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
},
"milestone"
:
{
"type"
:
[
"object"
,
"null"
],
"required"
:
[
"id"
,
"title"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
},
"lists"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"label"
,
"position"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"label"
:
{
"type"
:
[
"object"
,
"null"
],
"required"
:
[
"id"
,
"color"
,
"description"
,
"name"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"color"
:
{
"type"
:
"string"
,
"pattern"
:
"^#[0-9A-Fa-f]{3}{1,2}+$"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"name"
:
{
"type"
:
"string"
}
}
},
"position"
:
{
"type"
:
[
"integer"
,
"null"
]
}
},
"additionalProperties"
:
false
}
}
},
"additionalProperties"
:
false
}
This diff is collapsed.
Click to expand it.
spec/fixtures/api/schemas/public_api/v4/boards.json
0 → 100644
View file @
b1127d7d
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"board.json"
}
}
This diff is collapsed.
Click to expand it.
spec/requests/api/boards_spec.rb
View file @
b1127d7d
...
...
@@ -4,11 +4,11 @@ describe API::Boards, api: true do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:user
,
:admin
)
}
let!
(
:project
)
{
create
(
:empty_project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:dev_label
)
do
create
(
:label
,
title:
'Development'
,
color:
'#FFAABB'
,
project:
project
)
...
...
@@ -31,7 +31,7 @@ describe API::Boards, api: true do
end
let!
(
:board
)
do
create
(
:board
,
project:
project
,
lists:
[
dev_list
,
test_list
])
create
(
:board
,
project:
project
,
milestone:
milestone
,
lists:
[
dev_list
,
test_list
])
end
before
do
...
...
@@ -56,12 +56,7 @@ describe API::Boards, api: true do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
board
.
id
)
expect
(
json_response
.
first
[
'lists'
]).
to
be_an
Array
expect
(
json_response
.
first
[
'lists'
].
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'lists'
].
last
).
to
have_key
(
'position'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/boards'
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
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