-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure clients can handle empty oneOf objects (#1830)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
71984dc
commit 889b87f
Showing
5 changed files
with
182 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...335235736/Clients-deserialize-a-dashboard-with-a-empty-time-object_2253439787/frozen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"2024-09-24T19:19:31.807Z" |
110 changes: 110 additions & 0 deletions
110
...5235736/Clients-deserialize-a-dashboard-with-a-empty-time-object_2253439787/recording.har
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Dashboards/Clients deserialize a dashboard with a empty time object", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "25f142c77556d0a07f60c9aea7b1aa17", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 550, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
}, | ||
{ | ||
"_fromType": "array", | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 559, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "POST", | ||
"postData": { | ||
"mimeType": "application/json", | ||
"params": [], | ||
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571\",\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"time\":{},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"}}]}" | ||
}, | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/dashboard" | ||
}, | ||
"response": { | ||
"bodySize": 976, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 976, | ||
"text": "{\"id\":\"han-5zg-c32\",\"title\":\"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/han-5zg-c32/test-clientsdeserializeadashboardwithaemptytimeobject-1727205571\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"time\":{},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":4274057372149908}],\"notify_list\":null,\"created_at\":\"2024-09-24T19:19:32.071328+00:00\",\"modified_at\":\"2024-09-24T19:19:32.071328+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 657, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2024-09-24T19:19:31.819Z", | ||
"time": 291 | ||
}, | ||
{ | ||
"_id": "9350b5ff5d55807a27b71a985a5d0edd", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 0, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 520, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "DELETE", | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/dashboard/han-5zg-c32" | ||
}, | ||
"response": { | ||
"bodySize": 39, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 39, | ||
"text": "{\"deleted_dashboard_id\":\"han-5zg-c32\"}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 656, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2024-09-24T19:19:32.127Z", | ||
"time": 172 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Clients deserialize a dashboard with a empty time object | ||
*/ | ||
|
||
import { client, v1 } from "@datadog/datadog-api-client"; | ||
|
||
const configuration = client.createConfiguration(); | ||
const apiInstance = new v1.DashboardsApi(configuration); | ||
|
||
const params: v1.DashboardsApiCreateDashboardRequest = { | ||
body: { | ||
title: "Example-Dashboard", | ||
widgets: [ | ||
{ | ||
definition: { | ||
title: "Example Cloud Cost Query", | ||
titleSize: "16", | ||
titleAlign: "left", | ||
type: "timeseries", | ||
requests: [ | ||
{ | ||
formulas: [ | ||
{ | ||
formula: "query1", | ||
}, | ||
], | ||
queries: [ | ||
{ | ||
dataSource: "cloud_cost", | ||
name: "query1", | ||
query: | ||
"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)", | ||
}, | ||
], | ||
responseFormat: "timeseries", | ||
style: { | ||
palette: "dog_classic", | ||
lineType: "solid", | ||
lineWidth: "normal", | ||
}, | ||
displayType: "bars", | ||
}, | ||
], | ||
time: {}, | ||
}, | ||
}, | ||
], | ||
layoutType: "ordered", | ||
}, | ||
}; | ||
|
||
apiInstance | ||
.createDashboard(params) | ||
.then((data: v1.Dashboard) => { | ||
console.log( | ||
"API called successfully. Returned data: " + JSON.stringify(data) | ||
); | ||
}) | ||
.catch((error: any) => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters