Skip to content

Commit e0fb82d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Ensure clients can handle empty oneOf objects (#2022)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent fc52e62 commit e0fb82d

File tree

5 files changed

+107
-4
lines changed

5 files changed

+107
-4
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-09-30 13:56:52.203086",
8-
"spec_repo_commit": "eb66b1cf"
7+
"regenerated": "2024-09-30 14:37:35.409603",
8+
"spec_repo_commit": "60bc9127"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-30 13:56:52.217359",
13-
"spec_repo_commit": "eb66b1cf"
12+
"regenerated": "2024-09-30 14:37:35.426476",
13+
"spec_repo_commit": "60bc9127"
1414
}
1515
}
1616
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-09-24T19:19:31.807Z

cassettes/features/v1/dashboards/Clients-deserialize-a-dashboard-with-a-empty-time-object.yml

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Clients deserialize a dashboard with a empty time object
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
5+
6+
body = DatadogAPIClient::V1::Dashboard.new({
7+
title: "Example-Dashboard",
8+
widgets: [
9+
DatadogAPIClient::V1::Widget.new({
10+
definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({
11+
title: "Example Cloud Cost Query",
12+
title_size: "16",
13+
title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
14+
type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES,
15+
requests: [
16+
DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
17+
formulas: [
18+
DatadogAPIClient::V1::WidgetFormula.new({
19+
formula: "query1",
20+
}),
21+
],
22+
queries: [
23+
DatadogAPIClient::V1::FormulaAndFunctionCloudCostQueryDefinition.new({
24+
data_source: DatadogAPIClient::V1::FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
25+
name: "query1",
26+
query: "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
27+
}),
28+
],
29+
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
30+
style: DatadogAPIClient::V1::WidgetRequestStyle.new({
31+
palette: "dog_classic",
32+
line_type: DatadogAPIClient::V1::WidgetLineType::SOLID,
33+
line_width: DatadogAPIClient::V1::WidgetLineWidth::NORMAL,
34+
}),
35+
display_type: DatadogAPIClient::V1::WidgetDisplayType::BARS,
36+
}),
37+
],
38+
time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}),
39+
}),
40+
}),
41+
],
42+
layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
43+
})
44+
p api_instance.create_dashboard(body)

features/v1/dashboards.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Feature: Dashboards
99
And a valid "appKeyAuth" key in the system
1010
And an instance of "Dashboards" API
1111

12+
@replay-only @team:DataDog/dashboards-backend
13+
Scenario: Clients deserialize a dashboard with a empty time object
14+
Given new "CreateDashboard" request
15+
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "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": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ], "time": {} } } ], "layout_type": "ordered" }
16+
When the request is sent
17+
Then the response status is 200 OK
18+
And the response "widgets[0].definition.time" is equal to {}
19+
1220
@team:DataDog/dashboards-backend
1321
Scenario: Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
1422
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)