summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-01-05 14:29:37 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-01-05 14:29:37 +0000
commit0788b37fba26ab7113ff4a580d3fb92c926299b7 (patch)
tree60f1c6b649cd1380b2bc1c44c91b708ab6e6f67d
parent737f0ae8fdf3bdd23d02da8b7fbfd8e42ba78fdd (diff)
parent78cdac8401375cc85be54ae68e5d94d02a90233c (diff)
downloadgitlab-ce-0788b37fba26ab7113ff4a580d3fb92c926299b7.tar.gz
Merge branch 'api-domains-expose-project_id' into 'master'
Expose project_id on /api/v4/pages/domains See merge request gitlab-org/gitlab-ce!16200
-rw-r--r--changelogs/unreleased/api-domains-expose-project_id.yml5
-rw-r--r--doc/api/pages_domains.md1
-rw-r--r--lib/api/entities.rb1
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json3
-rw-r--r--spec/requests/api/pages_domains_spec.rb1
5 files changed, 10 insertions, 1 deletions
diff --git a/changelogs/unreleased/api-domains-expose-project_id.yml b/changelogs/unreleased/api-domains-expose-project_id.yml
new file mode 100644
index 00000000000..22617ffe9b5
--- /dev/null
+++ b/changelogs/unreleased/api-domains-expose-project_id.yml
@@ -0,0 +1,5 @@
+---
+title: Expose project_id on /api/v4/pages/domains
+merge_request: 16200
+author: Luc Didry
+type: changed
diff --git a/doc/api/pages_domains.md b/doc/api/pages_domains.md
index 50685f335f7..20275b902c6 100644
--- a/doc/api/pages_domains.md
+++ b/doc/api/pages_domains.md
@@ -21,6 +21,7 @@ curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/a
{
"domain": "ssl.domain.example",
"url": "https://ssl.domain.example",
+ "project_id": 1337,
"certificate": {
"expired": false,
"expiration": "2020-04-12T14:32:00.000Z"
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 516d767ef5e..bd0c54a1b04 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -1137,6 +1137,7 @@ module API
class PagesDomainBasic < Grape::Entity
expose :domain
expose :url
+ expose :project_id
expose :certificate,
as: :certificate_expiration,
if: ->(pages_domain, _) { pages_domain.certificate? },
diff --git a/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json b/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json
index 4ba6422406c..e8c17298b43 100644
--- a/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json
+++ b/spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json
@@ -3,6 +3,7 @@
"properties": {
"domain": { "type": "string" },
"url": { "type": "uri" },
+ "project_id": { "type": "integer" },
"certificate_expiration": {
"type": "object",
"properties": {
@@ -13,6 +14,6 @@
"additionalProperties": false
}
},
- "required": ["domain", "url"],
+ "required": ["domain", "url", "project_id"],
"additionalProperties": false
}
diff --git a/spec/requests/api/pages_domains_spec.rb b/spec/requests/api/pages_domains_spec.rb
index d412b045e9f..5d01dc37f0e 100644
--- a/spec/requests/api/pages_domains_spec.rb
+++ b/spec/requests/api/pages_domains_spec.rb
@@ -46,6 +46,7 @@ describe API::PagesDomains do
expect(json_response).to be_an Array
expect(json_response.size).to eq(3)
expect(json_response.last).to have_key('domain')
+ expect(json_response.last).to have_key('project_id')
expect(json_response.last).to have_key('certificate_expiration')
expect(json_response.last['certificate_expiration']['expired']).to be true
expect(json_response.first).not_to have_key('certificate_expiration')