Skip to content

Commit 80067d1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add JSONSchema assertion support to API and multistep tests (#1576)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 3cd812a commit 80067d1

File tree

28 files changed

+387
-117
lines changed

28 files changed

+387
-117
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.6",
7-
"regenerated": "2024-04-19 20:49:41.651088",
8-
"spec_repo_commit": "c3db9ec1"
7+
"regenerated": "2024-04-22 11:29:46.702337",
8+
"spec_repo_commit": "0f37d2e6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-04-19 20:49:41.669675",
13-
"spec_repo_commit": "c3db9ec1"
12+
"regenerated": "2024-04-22 11:29:46.720414",
13+
"spec_repo_commit": "0f37d2e6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13627,6 +13627,7 @@ components:
1362713627
oneOf:
1362813628
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
1362913629
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
13630+
- $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget'
1363013631
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
1363113632
SyntheticsAssertionJSONPathOperator:
1363213633
description: Assertion operator to apply.
@@ -13664,6 +13665,45 @@ components:
1366413665
targetValue:
1366513666
description: The path target value to compare to.
1366613667
type: object
13668+
SyntheticsAssertionJSONSchemaMetaSchema:
13669+
description: The JSON Schema meta-schema version used in the assertion.
13670+
enum:
13671+
- draft-07
13672+
- draft-06
13673+
type: string
13674+
x-enum-varnames:
13675+
- DRAFT_07
13676+
- DRAFT_06
13677+
SyntheticsAssertionJSONSchemaOperator:
13678+
description: Assertion operator to apply.
13679+
enum:
13680+
- validatesJSONSchema
13681+
example: validatesJSONSchema
13682+
type: string
13683+
x-enum-varnames:
13684+
- VALIDATES_JSON_SCHEMA
13685+
SyntheticsAssertionJSONSchemaTarget:
13686+
description: An assertion for the `validatesJSONSchema` operator.
13687+
properties:
13688+
operator:
13689+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaOperator'
13690+
target:
13691+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTargetTarget'
13692+
type:
13693+
$ref: '#/components/schemas/SyntheticsAssertionType'
13694+
required:
13695+
- type
13696+
- operator
13697+
type: object
13698+
SyntheticsAssertionJSONSchemaTargetTarget:
13699+
description: Composed target for `validatesJSONSchema` operator.
13700+
properties:
13701+
jsonSchema:
13702+
description: The JSON Schema to assert.
13703+
type: string
13704+
metaSchema:
13705+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaMetaSchema'
13706+
type: object
1366713707
SyntheticsAssertionOperator:
1366813708
description: Assertion operator to apply.
1366913709
enum:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2024-04-17T12:11:38.797Z"
1+
"2024-04-19T18:06:11.007Z"

cassettes/v1/Monitors_4022238206/Get-a-synthetics-monitor-s-details_2292154114/recording.har

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
},
99
"entries": [
1010
{
11-
"_id": "1341da1bcc02b2f592e0d99b2c6bd7d6",
11+
"_id": "7aa96dd034502a3c894d2c24f6af4b28",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
15-
"bodySize": 1753,
15+
"bodySize": 1929,
1616
"cookies": [],
1717
"headers": [
1818
{
@@ -32,17 +32,17 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"certificate\":{\"cert\":{\"content\":\"cert-content\",\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"content\":\"key-content\",\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1713355898\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"},\"variablesFromScript\":\"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\"},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713355898\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1713355898\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}"
35+
"text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesJSONSchema\",\"target\":{\"jsonSchema\":\"{\\\"type\\\": \\\"object\\\", \\\"properties\\\":{\\\"slideshow\\\":{\\\"type\\\":\\\"object\\\"}}}\",\"metaSchema\":\"draft-07\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"certificate\":{\"cert\":{\"content\":\"cert-content\",\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"content\":\"key-content\",\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1713549971\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"},\"variablesFromScript\":\"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\"},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713549971\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1713549971\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/api"
3939
},
4040
"response": {
41-
"bodySize": 2168,
41+
"bodySize": 2250,
4242
"content": {
4343
"mimeType": "application/json",
44-
"size": 2168,
45-
"text": "{\"public_id\":\"9b9-pwq-ged\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713355898\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2024-04-17T12:11:39.111595+00:00\",\"modified_at\":\"2024-04-17T12:11:39.111595+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1713355898\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"},\"variablesFromScript\":\"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\"},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1713355898\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"locations\":[\"aws:us-east-2\"],\"subtype\":\"http\",\"created_by\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"[email protected]\"},\"deleted_at\":null,\"monitor_id\":143340067,\"org_id\":321813,\"modified_by\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"[email protected]\"}}"
44+
"size": 2250,
45+
"text": "{\"public_id\":\"vp2-ewh-gtm\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713549971\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2024-04-19T18:06:11.424005+00:00\",\"modified_at\":\"2024-04-19T18:06:11.424005+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesJSONSchema\",\"target\":{\"jsonSchema\":\"{\\\"type\\\": \\\"object\\\", \\\"properties\\\":{\\\"slideshow\\\":{\\\"type\\\":\\\"object\\\"}}}\",\"metaSchema\":\"draft-07\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1713549971\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"},\"variablesFromScript\":\"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\"},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1713549971\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"locations\":[\"aws:us-east-2\"],\"subtype\":\"http\",\"created_by\":{\"name\":null,\"handle\":\"[email protected]\",\"email\":\"[email protected]\"},\"deleted_at\":null,\"monitor_id\":143517846,\"org_id\":321813,\"modified_by\":{\"name\":null,\"handle\":\"[email protected]\",\"email\":\"[email protected]\"}}"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -57,11 +57,11 @@
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2024-04-17T12:11:38.816Z",
61-
"time": 986
60+
"startedDateTime": "2024-04-19T18:06:11.016Z",
61+
"time": 1030
6262
},
6363
{
64-
"_id": "90d9ffe82454bf30ec5dcd226e3bfede",
64+
"_id": "d7158b31439a3c401c8067048fccbcd7",
6565
"_order": 0,
6666
"cache": {},
6767
"request": {
@@ -78,14 +78,14 @@
7878
"httpVersion": "HTTP/1.1",
7979
"method": "GET",
8080
"queryString": [],
81-
"url": "https://api.datadoghq.com/api/v1/monitor/143340067"
81+
"url": "https://api.datadoghq.com/api/v1/monitor/143517846"
8282
},
8383
"response": {
84-
"bodySize": 860,
84+
"bodySize": 813,
8585
"content": {
8686
"mimeType": "application/json",
87-
"size": 860,
88-
"text": "{\"id\":143340067,\"org_id\":321813,\"type\":\"synthetics alert\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713355898\",\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"tags\":[\"testing:api\",\"probe_dc:aws:us-east-2\",\"check_type:api\",\"check_status:live\",\"ci_execution_rule:blocking\"],\"query\":\"no_query\",\"options\":{\"on_missing_data\":\"show_no_data\",\"notify_audit\":false,\"new_host_delay\":300,\"include_tags\":true,\"synthetics_check_id\":\"9b9-pwq-ged\",\"silenced\":{}},\"multi\":false,\"created_at\":1713355899000,\"created\":\"2024-04-17T12:11:39.064494+00:00\",\"modified\":\"2024-04-17T12:11:39.064494+00:00\",\"deleted\":null,\"restricted_roles\":null,\"priority\":5,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"CI Account\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"id\":2320499}}\n"
87+
"size": 813,
88+
"text": "{\"id\":143517846,\"org_id\":321813,\"type\":\"synthetics alert\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1713549971\",\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"tags\":[\"testing:api\",\"probe_dc:aws:us-east-2\",\"check_type:api\",\"check_status:live\",\"ci_execution_rule:blocking\"],\"query\":\"no_query\",\"options\":{\"on_missing_data\":\"show_no_data\",\"notify_audit\":false,\"new_host_delay\":300,\"include_tags\":true,\"synthetics_check_id\":\"vp2-ewh-gtm\",\"silenced\":{}},\"multi\":false,\"created_at\":1713549971000,\"created\":\"2024-04-19T18:06:11.399838+00:00\",\"modified\":\"2024-04-19T18:06:11.399838+00:00\",\"deleted\":null,\"restricted_roles\":null,\"priority\":5,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":null,\"email\":\"frog@datadoghq.com\",\"handle\":\"[email protected]\",\"id\":1445416}}\n"
8989
},
9090
"cookies": [],
9191
"headers": [
@@ -100,11 +100,11 @@
100100
"status": 200,
101101
"statusText": "OK"
102102
},
103-
"startedDateTime": "2024-04-17T12:11:39.811Z",
104-
"time": 109
103+
"startedDateTime": "2024-04-19T18:06:12.066Z",
104+
"time": 133
105105
},
106106
{
107-
"_id": "9a565d42a589fd22aea0b111665fcd2b",
107+
"_id": "d91b960d151f7644a8cb97817f796bd2",
108108
"_order": 0,
109109
"cache": {},
110110
"request": {
@@ -128,7 +128,7 @@
128128
"postData": {
129129
"mimeType": "application/json",
130130
"params": [],
131-
"text": "{\"public_ids\":[\"9b9-pwq-ged\"]}"
131+
"text": "{\"public_ids\":[\"vp2-ewh-gtm\"]}"
132132
},
133133
"queryString": [],
134134
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/delete"
@@ -138,7 +138,7 @@
138138
"content": {
139139
"mimeType": "application/json",
140140
"size": 96,
141-
"text": "{\"deleted_tests\":[{\"public_id\":\"9b9-pwq-ged\",\"deleted_at\":\"2024-04-17T12:11:40.255350+00:00\"}]}\n"
141+
"text": "{\"deleted_tests\":[{\"public_id\":\"vp2-ewh-gtm\",\"deleted_at\":\"2024-04-19T18:06:12.668857+00:00\"}]}\n"
142142
},
143143
"cookies": [],
144144
"headers": [
@@ -153,8 +153,8 @@
153153
"status": 200,
154154
"statusText": "OK"
155155
},
156-
"startedDateTime": "2024-04-17T12:11:39.926Z",
157-
"time": 1012
156+
"startedDateTime": "2024-04-19T18:06:12.219Z",
157+
"time": 542
158158
}
159159
],
160160
"pages": [],
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2024-04-17T12:11:41.063Z"
1+
"2024-04-19T18:06:12.804Z"

0 commit comments

Comments
 (0)