Skip to content

Commit b220201

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Support schema version parameter in Get and List Service Definition endpoints (#1140)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 8381892 commit b220201

File tree

14 files changed

+134
-27
lines changed

14 files changed

+134
-27
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2023-05-11 14:31:08.955335",
8-
"spec_repo_commit": "b6d2ec34"
7+
"regenerated": "2023-05-12 13:13:12.164751",
8+
"spec_repo_commit": "9eca3996"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-05-11 14:31:08.973217",
13-
"spec_repo_commit": "b6d2ec34"
12+
"regenerated": "2023-05-12 13:13:12.177759",
13+
"spec_repo_commit": "9eca3996"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ components:
377377
required: true
378378
schema:
379379
type: string
380+
SchemaVersion:
381+
description: The schema version desired in the response.
382+
in: query
383+
name: schema_version
384+
required: false
385+
schema:
386+
$ref: '#/components/schemas/ServiceDefinitionSchemaVersions'
380387
SecurityFilterID:
381388
description: The ID of the security filter.
382389
in: path
@@ -12502,6 +12509,17 @@ components:
1250212509
- $ref: '#/components/schemas/ServiceDefinitionV2'
1250312510
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1'
1250412511
type: object
12512+
ServiceDefinitionSchemaVersions:
12513+
description: Schema versions
12514+
enum:
12515+
- v1
12516+
- v2
12517+
- v2.1
12518+
type: string
12519+
x-enum-varnames:
12520+
- V1
12521+
- V2
12522+
- V2_1
1250512523
ServiceDefinitionV1:
1250612524
deprecated: true
1250712525
description: Deprecated - Service definition V1 for providing additional service
@@ -22234,6 +22252,7 @@ paths:
2223422252
parameters:
2223522253
- $ref: '#/components/parameters/PageSize'
2223622254
- $ref: '#/components/parameters/PageNumber'
22255+
- $ref: '#/components/parameters/SchemaVersion'
2223722256
responses:
2223822257
'200':
2223922258
content:
@@ -22306,6 +22325,7 @@ paths:
2230622325
operationId: GetServiceDefinition
2230722326
parameters:
2230822327
- $ref: '#/components/parameters/ServiceName'
22328+
- $ref: '#/components/parameters/SchemaVersion'
2230922329
responses:
2231022330
'200':
2231122331
content:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2022-11-14T18:09:34.511Z"
1+
"2023-05-11T21:16:09.344Z"

cassettes/v2/Service-Definition_2211895093/Get-a-single-service-definition-returns-OK-response_1436718714/recording.har

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"entries": [
1010
{
11-
"_id": "be8075e0f29791c2ec2b8535512a50d0",
11+
"_id": "a15e7aa77c3493f4847cde6b73cc14d9",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
@@ -21,18 +21,23 @@
2121
"value": "application/json"
2222
}
2323
],
24-
"headersSize": 545,
24+
"headersSize": 565,
2525
"httpVersion": "HTTP/1.1",
2626
"method": "GET",
27-
"queryString": [],
28-
"url": "https://api.datadoghq.com/api/v2/services/definitions/service-definition-test"
27+
"queryString": [
28+
{
29+
"name": "schema_version",
30+
"value": "v2.1"
31+
}
32+
],
33+
"url": "https://api.datadoghq.com/api/v2/services/definitions/service-definition-test?schema_version=v2.1"
2934
},
3035
"response": {
31-
"bodySize": 976,
36+
"bodySize": 1017,
3237
"content": {
3338
"mimeType": "application/json",
34-
"size": 976,
35-
"text": "{\"data\":{\"type\":\"service-definition\",\"id\":\"77ae46b484fcfd92dc568170b1c534fe\",\"attributes\":{\"meta\":{\"last-modified-time\":\"2022-11-14T18:03:35Z\",\"github-html-url\":\"\",\"ingestion-source\":\"api\",\"warnings\":[],\"ingested-schema-version\":\"v2\"},\"schema\":{\"schema-version\":\"v2\",\"dd-service\":\"service-definition-test\",\"dd-team\":\"my-team\",\"team\":\"super-team\",\"contacts\":[{\"name\":\"Team Email\",\"type\":\"email\",\"contact\":\"[email protected]\"}],\"links\":[{\"name\":\"Runbook\",\"type\":\"runbook\",\"url\":\"https://my-runbook\"}],\"repos\":[{\"name\":\"Source Code\",\"provider\":\"GitHub\",\"url\":\"https://github.com/DataDog/schema\"}],\"docs\":[{\"name\":\"Architecture\",\"provider\":\"google drive\",\"url\":\"https://gdrive/mydoc\"}],\"tags\":[\"service:tag\",\"my:tag\"],\"integrations\":{\"pagerduty\":\"https://my-org.pagerduty.com/service-directory/PMyService\",\"opsgenie\":{\"service-url\":\"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\",\"region\":\"US\"}},\"extensions\":{\"myorgextension\":\"extensionvalue\"}}}}}\n"
39+
"size": 1017,
40+
"text": "{\"data\":{\"type\":\"service-definition\",\"id\":\"77ae46b484fcfd92dc568170b1c534fe\",\"attributes\":{\"meta\":{\"last-modified-time\":\"2023-04-18T16:19:17Z\",\"github-html-url\":\"\",\"ingestion-source\":\"api\",\"origin\":\"unknown\",\"origin-detail\":\"\",\"warnings\":[],\"ingested-schema-version\":\"v2\"},\"schema\":{\"schema-version\":\"v2.1\",\"dd-service\":\"service-definition-test\",\"team\":\"my-team\",\"contacts\":[{\"name\":\"Team Email\",\"type\":\"email\",\"contact\":\"[email protected]\"}],\"links\":[{\"name\":\"Runbook\",\"type\":\"runbook\",\"url\":\"https://my-runbook\"},{\"name\":\"Source Code\",\"type\":\"repo\",\"provider\":\"GitHub\",\"url\":\"https://github.com/DataDog/schema\"},{\"name\":\"Architecture\",\"type\":\"doc\",\"provider\":\"google drive\",\"url\":\"https://gdrive/mydoc\"}],\"tags\":[\"service:tag\",\"my:tag\"],\"integrations\":{\"pagerduty\":{\"service-url\":\"https://my-org.pagerduty.com/service-directory/PMyService\"},\"opsgenie\":{\"service-url\":\"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\",\"region\":\"US\"}},\"extensions\":{\"myorgextension\":\"extensionvalue\"}}}}}\n"
3641
},
3742
"cookies": [],
3843
"headers": [
@@ -41,14 +46,14 @@
4146
"value": "application/json"
4247
}
4348
],
44-
"headersSize": 628,
49+
"headersSize": 657,
4550
"httpVersion": "HTTP/1.1",
4651
"redirectURL": "",
4752
"status": 200,
4853
"statusText": "OK"
4954
},
50-
"startedDateTime": "2022-11-14T18:09:34.519Z",
51-
"time": 1538
55+
"startedDateTime": "2023-05-11T21:16:09.354Z",
56+
"time": 248
5257
}
5358
],
5459
"pages": [],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2022-10-10T12:54:43.916Z"
1+
"2023-05-11T21:15:27.277Z"

cassettes/v2/Service-Definition_2211895093/Get-all-service-definitions-returns-OK-response_3667194207/recording.har

Lines changed: 15 additions & 10 deletions
Large diffs are not rendered by default.

examples/v2/service-definition/GetServiceDefinition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const apiInstance = new v2.ServiceDefinitionApi(configuration);
99

1010
const params: v2.ServiceDefinitionApiGetServiceDefinitionRequest = {
1111
serviceName: "service-definition-test",
12+
schemaVersion: "v2.1",
1213
};
1314

1415
apiInstance

examples/v2/service-definition/ListServiceDefinitions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ import { client, v2 } from "@datadog/datadog-api-client";
77
const configuration = client.createConfiguration();
88
const apiInstance = new v2.ServiceDefinitionApi(configuration);
99

10+
const params: v2.ServiceDefinitionApiListServiceDefinitionsRequest = {
11+
schemaVersion: "v2.1",
12+
};
13+
1014
apiInstance
11-
.listServiceDefinitions()
15+
.listServiceDefinitions(params)
1216
.then((data: v2.ServiceDefinitionsListResponse) => {
1317
console.log(
1418
"API called successfully. Returned data: " + JSON.stringify(data)

features/support/scenarios_model_mapping.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,6 +4315,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
43154315
"type": "number",
43164316
"format": "int64",
43174317
},
4318+
"schemaVersion": {
4319+
"type": "ServiceDefinitionSchemaVersions",
4320+
"format": "",
4321+
},
43184322
"operationResponseType": "ServiceDefinitionsListResponse",
43194323
},
43204324
"v2.CreateOrUpdateServiceDefinitions": {
@@ -4336,6 +4340,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
43364340
"type": "string",
43374341
"format": "",
43384342
},
4343+
"schemaVersion": {
4344+
"type": "ServiceDefinitionSchemaVersions",
4345+
"format": "",
4346+
},
43394347
"operationResponseType": "ServiceDefinitionGetResponse",
43404348
},
43414349
"v2.GetOnDemandConcurrencyCap": {

features/v2/service_definition.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,21 @@ Feature: Service Definition
9494
Scenario: Get a single service definition returns "OK" response
9595
Given new "GetServiceDefinition" request
9696
And request contains "service_name" parameter with value "service-definition-test"
97+
And request contains "schema_version" parameter with value "v2.1"
9798
When the request is sent
9899
Then the response status is 200 OK
99100
And the response "data.attributes.meta.ingested-schema-version" is equal to "v2"
101+
And the response "data.attributes.schema.schema-version" is equal to "v2.1"
100102
And the response "data.attributes.schema.dd-service" is equal to "service-definition-test"
101103

102104
@team:DataDog/service-catalog
103105
Scenario: Get all service definitions returns "OK" response
104106
Given new "ListServiceDefinitions" request
107+
And request contains "schema_version" parameter with value "v2.1"
105108
When the request is sent
106109
Then the response status is 200 OK
107110
And the response "data[0].attributes.meta.ingestion-source" is equal to "api"
111+
And the response "data[0].attributes.schema.schema-version" is equal to "v2.1"
108112

109113
@replay-only @skip-validation @team:DataDog/service-catalog @with-pagination
110114
Scenario: Get all service definitions returns "OK" response with pagination

0 commit comments

Comments
 (0)