Skip to content

Commit d0ca82b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add originalFileName field to the SyntheticsTestRequestBodyFile definition (#127)
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 320e2b6 commit d0ca82b

8 files changed

+36
-11
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-06-03 16:54:46.556939",
8-
"spec_repo_commit": "df6778e5"
7+
"regenerated": "2024-06-04 15:12:26.486463",
8+
"spec_repo_commit": "60183db6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-06-03 16:54:46.574698",
13-
"spec_repo_commit": "df6778e5"
12+
"regenerated": "2024-06-04 15:12:26.504400",
13+
"spec_repo_commit": "60183db6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16075,6 +16075,10 @@ components:
1607516075
description: Name of the file.
1607616076
maxLength: 1500
1607716077
type: string
16078+
originalFileName:
16079+
description: Original name of the file.
16080+
maxLength: 1500
16081+
type: string
1607816082
size:
1607916083
description: Size of the file.
1608016084
format: int64

examples/v1_synthetics_create_synthetics_api_test_1241981394.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ async fn main() {
122122
.files(vec![SyntheticsTestRequestBodyFile::new()
123123
.content("file content".to_string())
124124
.name("file name".to_string())
125+
.original_file_name("image.png".to_string())
125126
.type_("file type".to_string())])
126127
.headers(BTreeMap::from([(
127128
"unique".to_string(),

src/datadogV1/model/model_synthetics_test_request_body_file.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pub struct SyntheticsTestRequestBodyFile {
2020
/// Name of the file.
2121
#[serde(rename = "name")]
2222
pub name: Option<String>,
23+
/// Original name of the file.
24+
#[serde(rename = "originalFileName")]
25+
pub original_file_name: Option<String>,
2326
/// Size of the file.
2427
#[serde(rename = "size")]
2528
pub size: Option<i64>,
@@ -37,6 +40,7 @@ impl SyntheticsTestRequestBodyFile {
3740
bucket_key: None,
3841
content: None,
3942
name: None,
43+
original_file_name: None,
4044
size: None,
4145
type_: None,
4246
_unparsed: false,
@@ -58,6 +62,11 @@ impl SyntheticsTestRequestBodyFile {
5862
self
5963
}
6064

65+
pub fn original_file_name(mut self, value: String) -> Self {
66+
self.original_file_name = Some(value);
67+
self
68+
}
69+
6170
pub fn size(mut self, value: i64) -> Self {
6271
self.size = Some(value);
6372
self
@@ -95,6 +104,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
95104
let mut bucket_key: Option<String> = None;
96105
let mut content: Option<String> = None;
97106
let mut name: Option<String> = None;
107+
let mut original_file_name: Option<String> = None;
98108
let mut size: Option<i64> = None;
99109
let mut type_: Option<String> = None;
100110
let mut _unparsed = false;
@@ -119,6 +129,13 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
119129
}
120130
name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
121131
}
132+
"originalFileName" => {
133+
if v.is_null() {
134+
continue;
135+
}
136+
original_file_name =
137+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
138+
}
122139
"size" => {
123140
if v.is_null() {
124141
continue;
@@ -139,6 +156,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
139156
bucket_key,
140157
content,
141158
name,
159+
original_file_name,
142160
size,
143161
type_,
144162
_unparsed,
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-04-02T15:35:39.188Z
1+
2024-05-30T13:32:57.127Z

tests/scenarios/cassettes/v1/synthetics/Create-an-API-test-with-a-file-payload-returns-OK-Returns-the-created-test-details-response.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"request": {
55
"body": {
6-
"string": "{\"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\"},\"bodyType\":\"application/octet-stream\",\"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\"}},\"files\":[{\"content\":\"file content\",\"name\":\"file name\",\"type\":\"file type\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1712072139\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1712072139\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1712072139\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}",
6+
"string": "{\"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\"},\"bodyType\":\"application/octet-stream\",\"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\"}},\"files\":[{\"content\":\"file content\",\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1717075977\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1717075977\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1717075977\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}",
77
"encoding": null
88
},
99
"headers": {
@@ -19,7 +19,7 @@
1919
},
2020
"response": {
2121
"body": {
22-
"string": "{\"public_id\":\"sxp-kz5-mk7\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1712072139\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2024-04-02T15:35:40.509801+00:00\",\"modified_at\":\"2024-04-02T15:35:40.509801+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\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"name\":\"file name\",\"type\":\"file type\",\"bucketKey\":\"api-upload-file/sxp-kz5-mk7/2024-04-02T15:35:40.363501_da19b48f-1756-453d-a03d-90526e629d7e.json\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1712072139\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"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-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1712072139\",\"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\":142439982,\"org_id\":321813,\"modified_by\":{\"name\":null,\"handle\":\"[email protected]\",\"email\":\"[email protected]\"}}",
22+
"string": "{\"public_id\":\"59e-ema-ct7\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1717075977\",\"status\":\"live\",\"type\":\"api\",\"tags\":[\"testing:api\"],\"created_at\":\"2024-05-30T13:32:58.047080+00:00\",\"modified_at\":\"2024-05-30T13:32:58.047080+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\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\",\"bucketKey\":\"api-upload-file/59e-ema-ct7/2024-05-30T13:32:57.804785_39e7dc32-8533-4979-b741-f10052a5e300.json\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1717075977\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"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-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1717075977\",\"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\":145992674,\"org_id\":321813,\"modified_by\":{\"name\":null,\"handle\":\"[email protected]\",\"email\":\"[email protected]\"}}",
2323
"encoding": null
2424
},
2525
"headers": {
@@ -32,12 +32,12 @@
3232
"message": "OK"
3333
}
3434
},
35-
"recorded_at": "Tue, 02 Apr 2024 15:35:39 GMT"
35+
"recorded_at": "Thu, 30 May 2024 13:32:57 GMT"
3636
},
3737
{
3838
"request": {
3939
"body": {
40-
"string": "{\"public_ids\":[\"sxp-kz5-mk7\"]}",
40+
"string": "{\"public_ids\":[\"59e-ema-ct7\"]}",
4141
"encoding": null
4242
},
4343
"headers": {
@@ -53,7 +53,7 @@
5353
},
5454
"response": {
5555
"body": {
56-
"string": "{\"deleted_tests\":[{\"public_id\":\"sxp-kz5-mk7\",\"deleted_at\":\"2024-04-02T15:35:41.326918+00:00\"}]}\n",
56+
"string": "{\"deleted_tests\":[{\"public_id\":\"59e-ema-ct7\",\"deleted_at\":\"2024-05-30T13:32:58.958184+00:00\"}]}\n",
5757
"encoding": null
5858
},
5959
"headers": {
@@ -66,7 +66,7 @@
6666
"message": "OK"
6767
}
6868
},
69-
"recorded_at": "Tue, 02 Apr 2024 15:35:39 GMT"
69+
"recorded_at": "Thu, 30 May 2024 13:32:57 GMT"
7070
}
7171
],
7272
"recorded_with": "VCR 6.0.0"

tests/scenarios/features/v1/synthetics.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ Feature: Synthetics
201201
Then the response status is 200 OK - Returns the created test details.
202202
And the response "name" is equal to "{{ unique }}"
203203
And the response "config.request.files[0].name" is equal to "file name"
204+
And the response "config.request.files[0].originalFileName" is equal to "image.png"
204205
And the response "config.request.files[0].type" is equal to "file type"
205206
And the response "config.request.files[0]" has field "bucketKey"
206207

tests/scenarios/features/v1/synthetics_api_http_test_with_file_payload.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"bodyType": "application/octet-stream",
6060
"files": [{
6161
"name": "file name",
62+
"originalFileName": "image.png",
6263
"content": "file content",
6364
"type": "file type"
6465
}],

0 commit comments

Comments
 (0)