Skip to content

Commit

Permalink
Extend Widget time schema with support for new fixed_span and live_sp…
Browse files Browse the repository at this point in the history
…an object (#2097)

* add support for additional:Properties false

* enable additionalProperties by default

* enabled additionalProps

* reduce change size

* Update .generator/src/generator/templates/model_generic.j2

Co-authored-by: jack-edmonds-dd <jack.edmonds@datadoghq.com>

* remove check

* Regenerate client from commit 2d21d782 of spec repo

---------

Co-authored-by: Anika Maskara <anika.maskara@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: Sherzod Karimov <sherzod.karimov@datadoghq.com>
Co-authored-by: skarimo <40482491+skarimo@users.noreply.github.com>
Co-authored-by: jack-edmonds-dd <jack.edmonds@datadoghq.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
6 people committed Sep 3, 2024
1 parent 29cd298 commit e3d4aa2
Show file tree
Hide file tree
Showing 64 changed files with 1,062 additions and 94 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-03 15:34:14.357115",
"spec_repo_commit": "e8b83f9d"
"regenerated": "2024-09-03 18:07:22.777136",
"spec_repo_commit": "2d21d782"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-03 15:34:14.374041",
"spec_repo_commit": "e8b83f9d"
"regenerated": "2024-09-03 18:07:22.794821",
"spec_repo_commit": "2d21d782"
}
}
}
89 changes: 85 additions & 4 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21867,6 +21867,13 @@ components:
type: string
x-enum-varnames:
- ORDERED
WidgetLegacyLiveSpan:
additionalProperties: false
description: Wrapper for live span
properties:
live_span:
$ref: '#/components/schemas/WidgetLiveSpan'
type: object
WidgetLegendSize:
description: Available legend sizes for a widget. Should be one of "0", "2",
"4", "8", "16", or "auto".
Expand Down Expand Up @@ -21933,6 +21940,24 @@ components:
- MONTH_TO_DATE
- PAST_ONE_YEAR
- ALERT
WidgetLiveSpanUnit:
description: Unit of the time span.
enum:
- minute
- hour
- day
- week
- month
- year
example: minute
type: string
x-enum-varnames:
- MINUTE
- HOUR
- DAY
- WEEK
- MONTH
- YEAR
WidgetMargin:
description: 'Size of the margins around the image.

Expand Down Expand Up @@ -22037,6 +22062,62 @@ components:
- TRIGGERED_DESCENDING
- PRIORITY_ASCENDING
- PRIORITY_DESCENDING
WidgetNewFixedSpan:
description: Used for fixed span times, such as 'March 1 to March 7'.
properties:
from:
description: Start time in seconds since epoch.
example: 1712080128
format: int64
minimum: 0
type: integer
to:
description: End time in seconds since epoch.
example: 1712083128
format: int64
minimum: 0
type: integer
type:
$ref: '#/components/schemas/WidgetNewFixedSpanType'
required:
- type
- from
- to
type: object
WidgetNewFixedSpanType:
description: Type "fixed" denotes a fixed span.
enum:
- fixed
example: fixed
type: string
x-enum-varnames:
- FIXED
WidgetNewLiveSpan:
description: Used for arbitrary live span times, such as 17 minutes or 6 hours.
properties:
type:
$ref: '#/components/schemas/WidgetNewLiveSpanType'
unit:
$ref: '#/components/schemas/WidgetLiveSpanUnit'
value:
description: Value of the time span.
example: 4
format: int64
minimum: 1
type: integer
required:
- type
- value
- unit
type: object
WidgetNewLiveSpanType:
description: Type "live" denotes a live span in the new format.
enum:
- live
example: live
type: string
x-enum-varnames:
- LIVE
WidgetNodeType:
description: Which type of node to use in the map.
enum:
Expand Down Expand Up @@ -22209,10 +22290,10 @@ components:
- TOP
WidgetTime:
description: Time setting for the widget.
properties:
live_span:
$ref: '#/components/schemas/WidgetLiveSpan'
type: object
oneOf:
- $ref: '#/components/schemas/WidgetLegacyLiveSpan'
- $ref: '#/components/schemas/WidgetNewLiveSpan'
- $ref: '#/components/schemas/WidgetNewFixedSpan'
WidgetTimeWindows:
description: Define a time window.
enum:
Expand Down
3 changes: 3 additions & 0 deletions .generator/src/generator/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ def format_data_with_schema_dict(
missing = required_properties - set(data.keys())
if missing:
raise ValueError(f"missing required properties: {missing}")
additional_properties = set(data.keys()) - set(schema["properties"].keys())
if schema.get("additionalProperties") == False and additional_properties:
raise ValueError(f"additional properties not allowed: {additional_properties}")

for k, v in data.items():
if k in schema["properties"]:
Expand Down
42 changes: 42 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5919,6 +5919,13 @@ datadog\_api\_client.v1.model.widget\_layout\_type module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_legacy\_live\_span module
---------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_legacy_live_span
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_line\_type module
-------------------------------------------------------

Expand All @@ -5940,6 +5947,13 @@ datadog\_api\_client.v1.model.widget\_live\_span module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_live\_span\_unit module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_live_span_unit
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_margin module
---------------------------------------------------

Expand Down Expand Up @@ -5975,6 +5989,34 @@ datadog\_api\_client.v1.model.widget\_monitor\_summary\_sort module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_new\_fixed\_span module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_new_fixed_span
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_new\_fixed\_span\_type module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_new_fixed_span_type
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_new\_live\_span module
------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_new_live_span
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_new\_live\_span\_type module
------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.widget_new_live_span_type
:members:
:show-inheritance:

datadog\_api\_client.v1.model.widget\_node\_type module
-------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_1177423752.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from datadog_api_client.v1.model.heat_map_widget_request import HeatMapWidgetRequest
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_style import WidgetStyle
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -30,7 +30,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=HeatMapWidgetDefinitionType.HEATMAP,
requests=[
HeatMapWidgetRequest(
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_1213075383.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_formula_sort import WidgetFormulaSort
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_sort import WidgetSort
from datadog_api_client.v1.model.widget_sort_by import WidgetSortBy
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -45,7 +45,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
style=ToplistWidgetStyle(
display=ToplistWidgetStacked(
type=ToplistWidgetStackedType.STACKED,
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_1284514532.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_line_type import WidgetLineType
from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth
from datadog_api_client.v1.model.widget_live_span import WidgetLiveSpan
from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand Down Expand Up @@ -58,7 +58,7 @@
display_type=WidgetDisplayType.BARS,
),
],
time=WidgetTime(
time=WidgetLegacyLiveSpan(
live_span=WidgetLiveSpan.WEEK_TO_DATE,
),
),
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_1307120899.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_line_type import WidgetLineType
from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth
from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard with ci_tests datasource",
Expand All @@ -47,7 +47,7 @@
TimeseriesWidgetLegendColumn.VALUE,
TimeseriesWidgetLegendColumn.SUM,
],
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=TimeseriesWidgetDefinitionType.TIMESERIES,
requests=[
TimeseriesWidgetRequest(
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_2064651578.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
from datadog_api_client.v1.model.widget_compare_to import WidgetCompareTo
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_order_by import WidgetOrderBy
from datadog_api_client.v1.model.widget_sort import WidgetSort
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -39,7 +39,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=ChangeWidgetDefinitionType.CHANGE,
requests=[
ChangeWidgetRequest(
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_2308247857.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime
from datadog_api_client.v1.model.widget_viz_type import WidgetVizType

# there is a valid "monitor" in the system
Expand All @@ -33,7 +33,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=AlertGraphWidgetDefinitionType.ALERT_GRAPH,
alert_id="7",
viz_type=WidgetVizType.TIMESERIES,
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_2336428357.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_formula_sort import WidgetFormulaSort
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_sort import WidgetSort
from datadog_api_client.v1.model.widget_sort_by import WidgetSortBy
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -42,7 +42,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=TableWidgetDefinitionType.QUERY_TABLE,
requests=[
TableWidgetRequest(
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_2342457693.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_axis import WidgetAxis
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -39,7 +39,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=ScatterPlotWidgetDefinitionType.SCATTERPLOT,
requests=ScatterPlotWidgetDefinitionRequests(
table=ScatterplotTableRequest(
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/dashboards/CreateDashboard_2349863258.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from datadog_api_client.v1.model.query_value_widget_request import QueryValueWidgetRequest
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.widget_time import WidgetTime

body = Dashboard(
title="Example-Dashboard",
Expand All @@ -35,7 +35,7 @@
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
time=WidgetTime(),
time=WidgetLegacyLiveSpan(),
type=QueryValueWidgetDefinitionType.QUERY_VALUE,
requests=[
QueryValueWidgetRequest(
Expand Down
Loading

0 comments on commit e3d4aa2

Please sign in to comment.