diff options
author | Luc Didry <luc@didry.org> | 2018-01-03 17:32:34 +0100 |
---|---|---|
committer | Luc Didry <luc@didry.org> | 2018-01-03 19:36:54 +0100 |
commit | 78cdac8401375cc85be54ae68e5d94d02a90233c (patch) | |
tree | 31d15b47a233c557d7299452ad7e39dd48d9f8b9 | |
parent | e5a9b9a14d32d890dea20403c977dfd569eb3e17 (diff) | |
download | gitlab-ce-78cdac8401375cc85be54ae68e5d94d02a90233c.tar.gz |
Expose project_id on /api/v4/pages/domains
-rw-r--r-- | changelogs/unreleased/api-domains-expose-project_id.yml | 5 | ||||
-rw-r--r-- | doc/api/pages_domains.md | 1 | ||||
-rw-r--r-- | lib/api/entities.rb | 1 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/public_api/v4/pages_domain/basic.json | 3 | ||||
-rw-r--r-- | spec/requests/api/pages_domains_spec.rb | 1 |
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 4ad4a1f7867..270b456597d 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1133,6 +1133,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') |