Commit f0454905 authored by Cristian Medina's avatar Cristian Medina

Modified lib/api/entities.rb to expose Project class tag_list property to the API

Updated projects.md to show tag_list field when performing GETs
Updated projects_spec.rb to include check for tag_list key in project list
Added changes to the CHANGELOG
parent 0d0042d2
...@@ -56,6 +56,7 @@ v 7.10.0 (unreleased) ...@@ -56,6 +56,7 @@ v 7.10.0 (unreleased)
- Fix "Hello @username." references not working by no longer allowing usernames to end in period. - Fix "Hello @username." references not working by no longer allowing usernames to end in period.
- Archive repositories in background worker. - Archive repositories in background worker.
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace. - Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
- Project labels are now available over the API under the "tag_list" field (Cristian Medina)
v 7.9.2 v 7.9.2
......
...@@ -44,6 +44,10 @@ Parameters: ...@@ -44,6 +44,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
"web_url": "http://example.com/diaspora/diaspora-client", "web_url": "http://example.com/diaspora/diaspora-client",
"tag_list": [
"example",
"disapora client"
],
"owner": { "owner": {
"id": 3, "id": 3,
"name": "Diaspora", "name": "Diaspora",
...@@ -80,6 +84,10 @@ Parameters: ...@@ -80,6 +84,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git", "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
"http_url_to_repo": "http://example.com/brightbox/puppet.git", "http_url_to_repo": "http://example.com/brightbox/puppet.git",
"web_url": "http://example.com/brightbox/puppet", "web_url": "http://example.com/brightbox/puppet",
"tag_list": [
"example",
"puppet"
],
"owner": { "owner": {
"id": 4, "id": 4,
"name": "Brightbox", "name": "Brightbox",
...@@ -163,6 +171,10 @@ Parameters: ...@@ -163,6 +171,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
"web_url": "http://example.com/diaspora/diaspora-project-site", "web_url": "http://example.com/diaspora/diaspora-project-site",
"tag_list": [
"example",
"disapora project"
],
"owner": { "owner": {
"id": 3, "id": 3,
"name": "Diaspora", "name": "Diaspora",
......
...@@ -46,7 +46,7 @@ module API ...@@ -46,7 +46,7 @@ module API
end end
class Project < Grape::Entity class Project < Grape::Entity
expose :id, :description, :default_branch expose :id, :description, :default_branch, :tag_list
expose :public?, as: :public expose :public?, as: :public
expose :archived?, as: :archived expose :archived?, as: :archived
expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
......
...@@ -57,7 +57,14 @@ describe API::API, api: true do ...@@ -57,7 +57,14 @@ describe API::API, api: true do
expect(json_response.first['name']).to eq(project.name) expect(json_response.first['name']).to eq(project.name)
expect(json_response.first['owner']['username']).to eq(user.username) expect(json_response.first['owner']['username']).to eq(user.username)
end end
it 'should include the project labels as the tag_list' do
get api('/projects', user)
response.status.should == 200
json_response.should be_an Array
json_response.first.keys.should include('tag_list')
end
context 'and using search' do context 'and using search' do
it 'should return searched project' do it 'should return searched project' do
get api('/projects', user), { search: project.name } get api('/projects', user), { search: project.name }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment