summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanadium23 <chernoffivan@gmail.com>2017-05-30 20:41:43 +0300
committervanadium23 <chernoffivan@gmail.com>2017-05-31 09:02:33 +0300
commit0684073d1ea5de0c7e0052b3ccc0cca77f661b56 (patch)
tree3b2869016ab37dbcbb00c14a4a81107f940d3128
parent8039b9c3c6caedc19e0e44d086a007e8975134b7 (diff)
downloadgitlab-ce-0684073d1ea5de0c7e0052b3ccc0cca77f661b56.tar.gz
Add tag_list param to project api
-rw-r--r--changelogs/unreleased/33000-tag-list-in-project-create-api.yml4
-rw-r--r--doc/api/projects.md3
-rw-r--r--lib/api/projects.rb2
-rw-r--r--spec/requests/api/projects_spec.rb8
4 files changed, 17 insertions, 0 deletions
diff --git a/changelogs/unreleased/33000-tag-list-in-project-create-api.yml b/changelogs/unreleased/33000-tag-list-in-project-create-api.yml
new file mode 100644
index 00000000000..b0d0d3cbeba
--- /dev/null
+++ b/changelogs/unreleased/33000-tag-list-in-project-create-api.yml
@@ -0,0 +1,4 @@
+---
+title: Add tag_list param to project api
+merge_request: 11799
+author: Ivan Chernov
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 345f93a6017..62c78ddc32e 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -473,6 +473,7 @@ Parameters:
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
+| `tag_list` | array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
### Create project for user
@@ -506,6 +507,7 @@ Parameters:
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
+| `tag_list` | array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
### Edit project
@@ -538,6 +540,7 @@ Parameters:
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
+| `tag_list` | array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
### Fork project
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index d4fe5c023bf..a827fb26b98 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -21,6 +21,7 @@ module API
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :only_allow_merge_if_pipeline_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
optional :only_allow_merge_if_all_discussions_are_resolved, type: Boolean, desc: 'Only allow to merge if all discussions are resolved'
+ optional :tag_list, type: Array[String], desc: 'The list of tags for a project'
end
params :optional_params do
@@ -231,6 +232,7 @@ module API
:request_access_enabled,
:shared_runners_enabled,
:snippets_enabled,
+ :tag_list,
:visibility,
:wiki_enabled
]
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index f95a287a184..3d98551628b 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -390,6 +390,14 @@ describe API::Projects do
expect(json_response['visibility']).to eq('private')
end
+ it 'sets tag list to a project' do
+ project = attributes_for(:project, tag_list: %w[tagFirst tagSecond])
+
+ post api('/projects', user), project
+
+ expect(json_response['tag_list']).to eq(%w[tagFirst tagSecond])
+ end
+
it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, { only_allow_merge_if_pipeline_succeeds: false })
post api('/projects', user), project