Skip to content

Commit 330aef7

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix Toplist widget's stacked display style - remove legend as required field (#1838)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 9032786 commit 330aef7

File tree

7 files changed

+209
-7
lines changed

7 files changed

+209
-7
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-10-02 14:33:57.486086",
8-
"spec_repo_commit": "3b4747f4"
7+
"regenerated": "2024-10-02 16:22:29.866275",
8+
"spec_repo_commit": "3f12bebc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-02 14:33:57.582216",
13-
"spec_repo_commit": "3b4747f4"
12+
"regenerated": "2024-10-02 16:22:29.880506",
13+
"spec_repo_commit": "3f12bebc"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18188,7 +18188,6 @@ components:
1818818188
$ref: '#/components/schemas/ToplistWidgetStackedType'
1818918189
required:
1819018190
- type
18191-
- legend
1819218191
type: object
1819318192
ToplistWidgetStackedType:
1819418193
default: stacked
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-09-30T17:24:52.299Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new dashboard with a toplist widget with stacked type and no legend specified",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "1668edb0df4aa19bf3e773c89dbafdd3",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 726,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 557,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"description\":\"\",\"is_read_only\":false,\"layout_type\":\"free\",\"notify_list\":[],\"template_variables\":[],\"title\":\"Test-Create_a_new_dashboard_with_a_toplist_widget_with_stacked_type_and_no_legend_specified-1727717092\",\"widgets\":[{\"definition\":{\"requests\":[{\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{*} by {service}\"}],\"response_format\":\"scalar\",\"sort\":{\"count\":10,\"order_by\":[{\"name\":\"service\",\"order\":\"asc\",\"type\":\"group\"}]}}],\"style\":{\"display\":{\"type\":\"stacked\"},\"palette\":\"dog_classic\",\"scaling\":\"relative\"},\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"toplist\"},\"layout\":{\"height\":15,\"width\":47,\"x\":0,\"y\":0}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 1082,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1082,
45+
"text": "{\"id\":\"2az-xeg-xar\",\"title\":\"Test-Create_a_new_dashboard_with_a_toplist_widget_with_stacked_type_and_no_legend_specified-1727717092\",\"description\":\"\",\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"free\",\"url\":\"/dashboard/2az-xeg-xar/test-createanewdashboardwithatoplistwidgetwithstackedtypeandnolegendspecified-17\",\"is_read_only\":false,\"template_variables\":[],\"widgets\":[{\"definition\":{\"requests\":[{\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{*} by {service}\"}],\"response_format\":\"scalar\",\"sort\":{\"count\":10,\"order_by\":[{\"name\":\"service\",\"order\":\"asc\",\"type\":\"group\"}]}}],\"style\":{\"display\":{\"type\":\"stacked\"},\"palette\":\"dog_classic\",\"scaling\":\"relative\"},\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"toplist\"},\"layout\":{\"height\":15,\"width\":47,\"x\":0,\"y\":0},\"id\":688132644515996}],\"notify_list\":[],\"created_at\":\"2024-09-30T17:24:52.542207+00:00\",\"modified_at\":\"2024-09-30T17:24:52.542207+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 657,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2024-09-30T17:24:52.306Z",
61+
"time": 295
62+
},
63+
{
64+
"_id": "bf18df2e89763aab55ba5494d3060e55",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 518,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/2az-xeg-xar"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"2az-xeg-xar\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 655,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2024-09-30T17:24:52.617Z",
104+
"time": 188
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* Create a new dashboard with a toplist widget with stacked type and no legend specified
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiCreateDashboardRequest = {
11+
body: {
12+
title: "Example-Dashboard",
13+
description: "",
14+
widgets: [
15+
{
16+
layout: {
17+
x: 0,
18+
y: 0,
19+
width: 47,
20+
height: 15,
21+
},
22+
definition: {
23+
title: "",
24+
titleSize: "16",
25+
titleAlign: "left",
26+
time: {},
27+
style: {
28+
display: {
29+
type: "stacked",
30+
},
31+
scaling: "relative",
32+
palette: "dog_classic",
33+
},
34+
type: "toplist",
35+
requests: [
36+
{
37+
queries: [
38+
{
39+
dataSource: "metrics",
40+
name: "query1",
41+
query: "avg:system.cpu.user{*} by {service}",
42+
aggregator: "avg",
43+
},
44+
],
45+
formulas: [
46+
{
47+
formula: "query1",
48+
},
49+
],
50+
sort: {
51+
count: 10,
52+
orderBy: [
53+
{
54+
type: "group",
55+
name: "service",
56+
order: "asc",
57+
},
58+
],
59+
},
60+
responseFormat: "scalar",
61+
},
62+
],
63+
},
64+
},
65+
],
66+
templateVariables: [],
67+
layoutType: "free",
68+
isReadOnly: false,
69+
notifyList: [],
70+
},
71+
};
72+
73+
apiInstance
74+
.createDashboard(params)
75+
.then((data: v1.Dashboard) => {
76+
console.log(
77+
"API called successfully. Returned data: " + JSON.stringify(data)
78+
);
79+
})
80+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,19 @@ Feature: Dashboards
206206
And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group"
207207
And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service"
208208

209+
@skip-typescript @team:DataDog/dashboards-backend
210+
Scenario: Create a new dashboard with a toplist widget with stacked type and no legend specified
211+
Given new "CreateDashboard" request
212+
And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked"},"scaling": "relative","palette": "dog_classic"},"type":"toplist","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","is_read_only":false,"notify_list":[]}
213+
When the request is sent
214+
Then the response status is 200 OK
215+
And the response "widgets[0].definition.type" is equal to "toplist"
216+
And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "asc"
217+
And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group"
218+
And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service"
219+
And the response "widgets[0].definition.style.display.type" is equal to "stacked"
220+
And the response "widgets[0].definition.style.display" does not have field "legend"
221+
209222
@team:DataDog/dashboards-backend
210223
Scenario: Create a new dashboard with alert_graph widget
211224
Given there is a valid "monitor" in the system

packages/datadog-api-client-v1/models/ToplistWidgetStacked.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ToplistWidgetStacked {
1515
/**
1616
* Top list widget stacked legend behavior.
1717
*/
18-
"legend": ToplistWidgetLegend;
18+
"legend"?: ToplistWidgetLegend;
1919
/**
2020
* Top list widget stacked display type.
2121
*/
@@ -40,7 +40,6 @@ export class ToplistWidgetStacked {
4040
legend: {
4141
baseName: "legend",
4242
type: "ToplistWidgetLegend",
43-
required: true,
4443
},
4544
type: {
4645
baseName: "type",

0 commit comments

Comments
 (0)