Commit 0788b37f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents 737f0ae8 78cdac84
---
title: Expose project_id on /api/v4/pages/domains
merge_request: 16200
author: Luc Didry
type: changed
......@@ -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"
......
......@@ -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? },
......
......@@ -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
}
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment