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 (#2629)

* add support for additionalProperties:false

* update api_dashboards_test

* 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: amaskara-dd <175134603+amaskara-dd@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
4 people authored Sep 3, 2024
1 parent 814e183 commit 6463640
Show file tree
Hide file tree
Showing 63 changed files with 1,378 additions and 211 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:16.910631",
"spec_repo_commit": "e8b83f9d"
"regenerated": "2024-09-03 18:07:15.535510",
"spec_repo_commit": "2d21d782"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-03 15:34:16.928568",
"spec_repo_commit": "e8b83f9d"
"regenerated": "2024-09-03 18:07:15.553692",
"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 @@ -604,6 +604,9 @@ def format_data_with_schema_dict(
missing = required_properties - set(data.keys())
if missing:
raise ValueError(f"missing required properties: {missing}")
additionalProperties = set(data.keys()) - set(schema["properties"].keys())
if schema.get("additionalProperties") == False and additionalProperties:
raise ValueError(f"additional properties not allowed: {additionalProperties}")

for k, v in data.items():
if k not in schema["properties"]:
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_alert_graph_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {

hasInvalidField := false
o.AlertId = *all.AlertId
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_change_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField := false
o.CustomLinks = all.CustomLinks
o.Requests = *all.Requests
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_check_status_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,6 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.Grouping = *all.Grouping
}
o.Tags = all.Tags
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_distribution_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,6 @@ func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.Markers = all.Markers
o.Requests = *all.Requests
o.ShowLegend = all.ShowLegend
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_event_stream_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
}
o.Query = *all.Query
o.TagsExecution = all.TagsExecution
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_event_timeline_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error)
hasInvalidField := false
o.Query = *all.Query
o.TagsExecution = all.TagsExecution
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_funnel_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {

hasInvalidField := false
o.Requests = *all.Requests
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_geomap_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,6 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Style = *all.Style
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_heat_map_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,6 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.LegendSize = all.LegendSize
o.Requests = *all.Requests
o.ShowLegend = all.ShowLegend
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_list_stream_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,6 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.LegendSize = all.LegendSize
o.Requests = *all.Requests
o.ShowLegend = all.ShowLegend
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_log_stream_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@ func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Sort = all.Sort
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_query_value_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
} else {
o.TextAlign = all.TextAlign
}
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
if all.TimeseriesBackground != nil && all.TimeseriesBackground.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_run_workflow_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,6 @@ func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField := false
o.CustomLinks = all.CustomLinks
o.Inputs = all.Inputs
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_scatter_plot_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,6 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Requests = *all.Requests
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_service_summary_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error)
o.SizeFormat = all.SizeFormat
}
o.SpanName = *all.SpanName
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_split_graph_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ func (o *SplitGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.SplitConfig = *all.SplitConfig
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if !all.Type.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_sunburst_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,6 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.HideTotal = all.HideTotal
o.Legend = all.Legend
o.Requests = *all.Requests
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_table_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
o.HasSearchBar = all.HasSearchBar
}
o.Requests = *all.Requests
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_timeseries_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,6 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
}
o.RightYaxis = all.RightYaxis
o.ShowLegend = all.ShowLegend
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_toplist_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Style = all.Style
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if all.TitleAlign != nil && !all.TitleAlign.IsValid() {
Expand Down
3 changes: 0 additions & 3 deletions api/datadogV1/model_tree_map_widget_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
} else {
o.SizeBy = all.SizeBy
}
if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Time = all.Time
o.Title = all.Title
if !all.Type.IsValid() {
Expand Down
Loading

0 comments on commit 6463640

Please sign in to comment.