From b807b42aa3bac6c527485d30f953f7b2f1323a95 Mon Sep 17 00:00:00 2001 From: Andrea Leone Date: Sat, 7 Sep 2019 10:18:31 +0200 Subject: Expose :protected field for ../tags/:tag_name API endpoint --- lib/api/entities.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index f7cd6d35854..3c7fa8caa61 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1263,6 +1263,11 @@ module API options[:project].releases.find_by(tag: repo_tag.name) end # rubocop: enable CodeReuse/ActiveRecord + + expose :protected do |repo_tag, options| + ::ProtectedTag.protected?(options[:project], repo_tag.name) + end + end class Runner < Grape::Entity -- cgit v1.2.1 From 26435701bc08095c2e3df259aa1a8f110ed4c51c Mon Sep 17 00:00:00 2001 From: Andrea Leone Date: Sat, 7 Sep 2019 13:09:55 +0200 Subject: Fix after 'static-analysis' job fail --- lib/api/entities.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3c7fa8caa61..689c71e455e 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1267,7 +1267,6 @@ module API expose :protected do |repo_tag, options| ::ProtectedTag.protected?(options[:project], repo_tag.name) end - end class Runner < Grape::Entity -- cgit v1.2.1 From a3d075e8022805355110c1bc20ff31520fd4f15e Mon Sep 17 00:00:00 2001 From: Andrea Leone Date: Sat, 7 Sep 2019 14:35:53 +0200 Subject: Update API schema for Tag --- spec/fixtures/api/schemas/public_api/v4/tag.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/api/schemas/public_api/v4/tag.json b/spec/fixtures/api/schemas/public_api/v4/tag.json index 5713ea1f526..bb0190955f0 100644 --- a/spec/fixtures/api/schemas/public_api/v4/tag.json +++ b/spec/fixtures/api/schemas/public_api/v4/tag.json @@ -16,7 +16,8 @@ { "type": "null" }, { "$ref": "release/tag_release.json" } ] - } + }, + "protected": { "type": "boolean" } }, "additionalProperties": false } -- cgit v1.2.1 From 393554de324f66c64c35654809dcf7b0084debeb Mon Sep 17 00:00:00 2001 From: Andrea Leone Date: Sun, 8 Sep 2019 20:49:29 +0200 Subject: Update API doc for Tag --- doc/api/tags.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/api/tags.md b/doc/api/tags.md index 1d874fea1f8..88f63d6b34b 100644 --- a/doc/api/tags.md +++ b/doc/api/tags.md @@ -46,7 +46,8 @@ Parameters: }, "name": "v1.0.0", "target": "2695effb5807a22ff3d138d593fd856244e155e7", - "message": null + "message": null, + "protected": true } ] ``` @@ -94,7 +95,8 @@ Example Response: "committer_email": "contact@arthurverschaeve.be", "committed_date": "2015-02-01T21:56:31.000+01:00" }, - "release": null + "release": null, + "protected": false } ``` @@ -138,7 +140,8 @@ Parameters: }, "name": "v1.0.0", "target": "2695effb5807a22ff3d138d593fd856244e155e7", - "message": null + "message": null, + "protected": false } ``` -- cgit v1.2.1 From 197654fc6a07ab635ea5aed9fe648906953182b8 Mon Sep 17 00:00:00 2001 From: Andrea Leone Date: Sun, 8 Sep 2019 20:50:25 +0200 Subject: Add Changelog entry --- changelogs/unreleased/issue-67127.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/issue-67127.yml diff --git a/changelogs/unreleased/issue-67127.yml b/changelogs/unreleased/issue-67127.yml new file mode 100644 index 00000000000..70848dc6ff9 --- /dev/null +++ b/changelogs/unreleased/issue-67127.yml @@ -0,0 +1,5 @@ +--- +title: Expose 'protected' field for Tag API endpoint. +merge_request: 32790 +author: Andrea Leone +type: added -- cgit v1.2.1