summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2015-11-21 17:29:26 +0100
committerRobert Schilling <rschilling@student.tugraz.at>2015-11-21 17:29:26 +0100
commit2cba93a0d2d12ee36bf98569e5c6c14ac7ea40e0 (patch)
tree2d98ebaa9c4640d0e16b1dcd3e1339e6dbb0a0dd
parent4427e80fb5a8b42b1de04f8346bf0dd431e7dd86 (diff)
downloadgitlab-ce-2cba93a0d2d12ee36bf98569e5c6c14ac7ea40e0.tar.gz
Make tag API consistent for release feature
-rw-r--r--doc/api/tags.md10
-rw-r--r--lib/api/entities.rb3
-rw-r--r--lib/api/tags.rb8
-rw-r--r--spec/requests/api/tags_spec.rb6
4 files changed, 14 insertions, 13 deletions
diff --git a/doc/api/tags.md b/doc/api/tags.md
index b5b90cf6b82..cf95f87dc3e 100644
--- a/doc/api/tags.md
+++ b/doc/api/tags.md
@@ -29,7 +29,7 @@ Parameters:
]
},
"release": {
- "tag": "1.0.0",
+ "tag_name": "1.0.0",
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
@@ -70,7 +70,7 @@ Parameters:
]
},
"release": {
- "tag": "1.0.0",
+ "tag_name": "1.0.0",
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
@@ -89,18 +89,18 @@ It returns 200 if the operation succeed. In case of an error,
Add release notes to the existing git tag
```
-PUT /projects/:id/repository/:tag/release
+PUT /projects/:id/repository/tags/:tag_name/release
```
Parameters:
- `id` (required) - The ID of a project
-- `tag` (required) - The name of a tag
+- `tag_name` (required) - The name of a tag
- `description` (required) - Release notes with markdown support
```json
{
- "tag": "1.0.0",
+ "tag_name": "1.0.0",
"description": "Amazing release. Wow"
}
```
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 3da6bc415d6..5dea74db295 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -322,7 +322,8 @@ module API
end
class Release < Grape::Entity
- expose :tag, :description
+ expose :tag, as: :tag_name
+ expose :description
end
class RepoTag < Grape::Entity
diff --git a/lib/api/tags.rb b/lib/api/tags.rb
index 673342dd447..2c6c73da08e 100644
--- a/lib/api/tags.rb
+++ b/lib/api/tags.rb
@@ -44,14 +44,14 @@ module API
#
# Parameters:
# id (required) - The ID of a project
- # tag (required) - The name of the tag
+ # tag_name (required) - The name of the tag
# description (required) - Release notes with markdown support
# Example Request:
- # PUT /projects/:id/repository/tags
- put ':id/repository/:tag/release', requirements: { tag: /.*/ } do
+ # PUT /projects/:id/repository/tags/:tag_name/release
+ put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do
authorize_push_project
required_attributes! [:description]
- release = user_project.releases.find_or_initialize_by(tag: params[:tag])
+ release = user_project.releases.find_or_initialize_by(tag: params[:tag_name])
release.update_attributes(description: params[:description])
present release, with: Entities::Release
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index cc9a5f47582..e3fd2d547c4 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -119,16 +119,16 @@ describe API::API, api: true do
end
end
- describe 'PUT /projects/:id/repository/:tag/release' do
+ describe 'PUT /projects/:id/repository/tags/:tag_name/release' do
let(:tag_name) { project.repository.tag_names.first }
let(:description) { 'Awesome release!' }
it 'should create description for existing git tag' do
- put api("/projects/#{project.id}/repository/#{tag_name}/release", user),
+ put api("/projects/#{project.id}/repository/tags/#{tag_name}/release", user),
description: description
expect(response.status).to eq(200)
- expect(json_response['tag']).to eq(tag_name)
+ expect(json_response['tag_name']).to eq(tag_name)
expect(json_response['description']).to eq(description)
end
end