Skip to content

Commit d0af44a

Browse files
api-clients-generation-pipeline[bot]amaskara-ddci.datadog-api-spec
authored
Extend Widget time schema with support for new fixed_span and live_span object (#1749)
* add support for additionalProperties:false * Regenerate client from commit 2d21d782 of spec repo --------- Co-authored-by: Anika Maskara <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 3fef249 commit d0af44a

File tree

22 files changed

+940
-52
lines changed

22 files changed

+940
-52
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-03 15:34:14.455892",
8-
"spec_repo_commit": "e8b83f9d"
7+
"regenerated": "2024-09-03 18:07:12.279497",
8+
"spec_repo_commit": "2d21d782"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-03 15:34:14.474208",
13-
"spec_repo_commit": "e8b83f9d"
12+
"regenerated": "2024-09-03 18:07:12.298089",
13+
"spec_repo_commit": "2d21d782"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21867,6 +21867,13 @@ components:
2186721867
type: string
2186821868
x-enum-varnames:
2186921869
- ORDERED
21870+
WidgetLegacyLiveSpan:
21871+
additionalProperties: false
21872+
description: Wrapper for live span
21873+
properties:
21874+
live_span:
21875+
$ref: '#/components/schemas/WidgetLiveSpan'
21876+
type: object
2187021877
WidgetLegendSize:
2187121878
description: Available legend sizes for a widget. Should be one of "0", "2",
2187221879
"4", "8", "16", or "auto".
@@ -21933,6 +21940,24 @@ components:
2193321940
- MONTH_TO_DATE
2193421941
- PAST_ONE_YEAR
2193521942
- ALERT
21943+
WidgetLiveSpanUnit:
21944+
description: Unit of the time span.
21945+
enum:
21946+
- minute
21947+
- hour
21948+
- day
21949+
- week
21950+
- month
21951+
- year
21952+
example: minute
21953+
type: string
21954+
x-enum-varnames:
21955+
- MINUTE
21956+
- HOUR
21957+
- DAY
21958+
- WEEK
21959+
- MONTH
21960+
- YEAR
2193621961
WidgetMargin:
2193721962
description: 'Size of the margins around the image.
2193821963

@@ -22037,6 +22062,62 @@ components:
2203722062
- TRIGGERED_DESCENDING
2203822063
- PRIORITY_ASCENDING
2203922064
- PRIORITY_DESCENDING
22065+
WidgetNewFixedSpan:
22066+
description: Used for fixed span times, such as 'March 1 to March 7'.
22067+
properties:
22068+
from:
22069+
description: Start time in seconds since epoch.
22070+
example: 1712080128
22071+
format: int64
22072+
minimum: 0
22073+
type: integer
22074+
to:
22075+
description: End time in seconds since epoch.
22076+
example: 1712083128
22077+
format: int64
22078+
minimum: 0
22079+
type: integer
22080+
type:
22081+
$ref: '#/components/schemas/WidgetNewFixedSpanType'
22082+
required:
22083+
- type
22084+
- from
22085+
- to
22086+
type: object
22087+
WidgetNewFixedSpanType:
22088+
description: Type "fixed" denotes a fixed span.
22089+
enum:
22090+
- fixed
22091+
example: fixed
22092+
type: string
22093+
x-enum-varnames:
22094+
- FIXED
22095+
WidgetNewLiveSpan:
22096+
description: Used for arbitrary live span times, such as 17 minutes or 6 hours.
22097+
properties:
22098+
type:
22099+
$ref: '#/components/schemas/WidgetNewLiveSpanType'
22100+
unit:
22101+
$ref: '#/components/schemas/WidgetLiveSpanUnit'
22102+
value:
22103+
description: Value of the time span.
22104+
example: 4
22105+
format: int64
22106+
minimum: 1
22107+
type: integer
22108+
required:
22109+
- type
22110+
- value
22111+
- unit
22112+
type: object
22113+
WidgetNewLiveSpanType:
22114+
description: Type "live" denotes a live span in the new format.
22115+
enum:
22116+
- live
22117+
example: live
22118+
type: string
22119+
x-enum-varnames:
22120+
- LIVE
2204022121
WidgetNodeType:
2204122122
description: Which type of node to use in the map.
2204222123
enum:
@@ -22209,10 +22290,10 @@ components:
2220922290
- TOP
2221022291
WidgetTime:
2221122292
description: Time setting for the widget.
22212-
properties:
22213-
live_span:
22214-
$ref: '#/components/schemas/WidgetLiveSpan'
22215-
type: object
22293+
oneOf:
22294+
- $ref: '#/components/schemas/WidgetLegacyLiveSpan'
22295+
- $ref: '#/components/schemas/WidgetNewLiveSpan'
22296+
- $ref: '#/components/schemas/WidgetNewFixedSpan'
2221622297
WidgetTimeWindows:
2221722298
description: Define a time window.
2221822299
enum:

.generator/src/generator/formatter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ def format_data_with_schema_dict(
337337
missing = required_properties - set(data.keys())
338338
if missing:
339339
raise ValueError(f"missing required properties: {missing}")
340+
additionalProperties = set(data.keys()) - set(schema["properties"].keys())
341+
if schema.get("additionalProperties") == False and additionalProperties:
342+
raise ValueError(f"additional properties not allowed: {additionalProperties}")
340343

341344
for k, v in data.items():
342345
if k not in schema["properties"]:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-08-08T16:08:49.284Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new timeseries widget with legacy live span time format",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "1627fd1f28110b2aceeda4364777902f",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 704,
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": 559,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1723133329 with legacy live span time\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 1152,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1152,
45+
"text": "{\"id\":\"dfy-yby-e2c\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1723133329 with legacy live span time\",\"description\":null,\"author_handle\":\"d5459c54-9e9d-11ee-a5c9-ce6dc639753f\",\"author_name\":\"CI Service Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/dfy-yby-e2c/test-createanewtimeserieswidgetwithlegacylivespantimeformat-1723133329-with-lega\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"},\"id\":6745766981061097}],\"notify_list\":null,\"created_at\":\"2024-08-08T16:08:49.543129+00:00\",\"modified_at\":\"2024-08-08T16:08:49.543129+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 658,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2024-08-08T16:08:49.293Z",
61+
"time": 457
62+
},
63+
{
64+
"_id": "79e2eafca363ed924ea18bf392a3f5c7",
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": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/dfy-yby-e2c"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"dfy-yby-e2c\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 656,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2024-08-08T16:08:49.762Z",
104+
"time": 222
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-08-08T16:09:04.492Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new timeseries widget with new fixed span time format",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "285aa01e11666786677cd7a20038bb37",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 732,
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": 559,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_new_fixed_span_time_format-1723133344 with new fixed span time\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"from\":1712080128,\"to\":1712083128,\"type\":\"fixed\"},\"title\":\"\",\"type\":\"timeseries\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 1180,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1180,
45+
"text": "{\"id\":\"kvv-wiy-nsu\",\"title\":\"Test-Create_a_new_timeseries_widget_with_new_fixed_span_time_format-1723133344 with new fixed span time\",\"description\":null,\"author_handle\":\"d5459c54-9e9d-11ee-a5c9-ce6dc639753f\",\"author_name\":\"CI Service Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/kvv-wiy-nsu/test-createanewtimeserieswidgetwithnewfixedspantimeformat-1723133344-with-new-fi\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"from\":1712080128,\"to\":1712083128,\"type\":\"fixed\"},\"title\":\"\",\"type\":\"timeseries\"},\"id\":1421131468062823}],\"notify_list\":null,\"created_at\":\"2024-08-08T16:09:04.750457+00:00\",\"modified_at\":\"2024-08-08T16:09:04.750457+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 658,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2024-08-08T16:09:04.501Z",
61+
"time": 420
62+
},
63+
{
64+
"_id": "f52201862fe593c440574f9e6ac0ea4b",
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": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/kvv-wiy-nsu"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"kvv-wiy-nsu\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 656,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2024-08-08T16:09:04.933Z",
104+
"time": 172
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-08-08T16:09:15.828Z"

0 commit comments

Comments
 (0)