Skip to content

Commit 0f97808

Browse files
api-clients-generation-pipeline[bot]therveci.datadog-api-spec
authored
Add split graph widget to dashboard schema (#1644)
* Handle arrays of arrays * Regenerate client from commit dfa5ada6 of spec repo --------- Co-authored-by: Thomas Hervé <[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 b5fbbf7 commit 0f97808

21 files changed

+1129
-43
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.5",
7-
"regenerated": "2023-09-14 14:35:30.424386",
8-
"spec_repo_commit": "1d834ec1"
7+
"regenerated": "2023-09-15 14:38:34.839281",
8+
"spec_repo_commit": "dfa5ada6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-09-14 14:35:30.441566",
13-
"spec_repo_commit": "1d834ec1"
12+
"regenerated": "2023-09-15 14:38:34.866653",
13+
"spec_repo_commit": "dfa5ada6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 170 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12058,6 +12058,170 @@ components:
1205812058
items:
1205912059
$ref: '#/components/schemas/SlackIntegrationChannel'
1206012060
type: array
12061+
SplitConfig:
12062+
description: Encapsulates all user choices about how to split a graph.
12063+
properties:
12064+
limit:
12065+
description: Maximum number of graphs to display in the widget.
12066+
example: 24
12067+
format: int64
12068+
maximum: 100
12069+
minimum: 1
12070+
type: integer
12071+
sort:
12072+
$ref: '#/components/schemas/SplitSort'
12073+
split_dimensions:
12074+
description: The dimension(s) on which to split the graph
12075+
items:
12076+
$ref: '#/components/schemas/SplitDimension'
12077+
maxItems: 1
12078+
minItems: 1
12079+
type: array
12080+
static_splits:
12081+
description: Manual selection of tags making split graph widget static
12082+
items:
12083+
$ref: '#/components/schemas/SplitVectorEntry'
12084+
maxItems: 100
12085+
type: array
12086+
required:
12087+
- split_dimensions
12088+
- limit
12089+
- sort
12090+
type: object
12091+
SplitConfigSortCompute:
12092+
description: Defines the metric and aggregation used as the sort value.
12093+
properties:
12094+
aggregation:
12095+
description: The metric to use for sorting graphs.
12096+
example: sum
12097+
type: string
12098+
metric:
12099+
description: How to aggregate the sort metric for the purposes of ordering.
12100+
example: system.cpu.user
12101+
type: string
12102+
required:
12103+
- aggregation
12104+
- metric
12105+
type: object
12106+
SplitDimension:
12107+
description: The property by which the graph splits
12108+
example:
12109+
one_graph_per: service
12110+
properties:
12111+
one_graph_per:
12112+
description: The system interprets this attribute differently depending
12113+
on the data source of the query being split. For metrics, it's a tag.
12114+
For the events platform, it's an attribute or tag.
12115+
example: service
12116+
type: string
12117+
required:
12118+
- one_graph_per
12119+
type: object
12120+
SplitGraphSourceWidgetDefinition:
12121+
description: The original widget we are splitting on.
12122+
oneOf:
12123+
- $ref: '#/components/schemas/ChangeWidgetDefinition'
12124+
- $ref: '#/components/schemas/GeomapWidgetDefinition'
12125+
- $ref: '#/components/schemas/QueryValueWidgetDefinition'
12126+
- $ref: '#/components/schemas/ScatterPlotWidgetDefinition'
12127+
- $ref: '#/components/schemas/SunburstWidgetDefinition'
12128+
- $ref: '#/components/schemas/TableWidgetDefinition'
12129+
- $ref: '#/components/schemas/TimeseriesWidgetDefinition'
12130+
- $ref: '#/components/schemas/ToplistWidgetDefinition'
12131+
- $ref: '#/components/schemas/TreeMapWidgetDefinition'
12132+
SplitGraphVizSize:
12133+
description: Size of the individual graphs in the split.
12134+
enum:
12135+
- xs
12136+
- sm
12137+
- md
12138+
- lg
12139+
example: sm
12140+
type: string
12141+
x-enum-varnames:
12142+
- XS
12143+
- SM
12144+
- MD
12145+
- LG
12146+
SplitGraphWidgetDefinition:
12147+
description: 'The split graph widget allows you to create repeating units of
12148+
a graph - one for each value in a group (for example: one per service)
12149+
12150+
'
12151+
properties:
12152+
has_uniform_y_axes:
12153+
description: Normalize y axes across graphs
12154+
type: boolean
12155+
size:
12156+
$ref: '#/components/schemas/SplitGraphVizSize'
12157+
source_widget_definition:
12158+
$ref: '#/components/schemas/SplitGraphSourceWidgetDefinition'
12159+
split_config:
12160+
$ref: '#/components/schemas/SplitConfig'
12161+
time:
12162+
$ref: '#/components/schemas/WidgetTime'
12163+
title:
12164+
description: Title of your widget.
12165+
type: string
12166+
type:
12167+
$ref: '#/components/schemas/SplitGraphWidgetDefinitionType'
12168+
required:
12169+
- size
12170+
- type
12171+
- source_widget_definition
12172+
- split_config
12173+
type: object
12174+
SplitGraphWidgetDefinitionType:
12175+
default: split_group
12176+
description: Type of the split graph widget
12177+
enum:
12178+
- split_group
12179+
example: split_group
12180+
type: string
12181+
x-enum-varnames:
12182+
- SPLIT_GROUP
12183+
SplitSort:
12184+
description: Controls the order in which graphs appear in the split.
12185+
properties:
12186+
compute:
12187+
$ref: '#/components/schemas/SplitConfigSortCompute'
12188+
order:
12189+
$ref: '#/components/schemas/WidgetSort'
12190+
required:
12191+
- order
12192+
type: object
12193+
SplitVectorEntry:
12194+
description: The widget displays one graph for each entry in this parameter.
12195+
example:
12196+
- tag_key: demo
12197+
tag_values:
12198+
- env
12199+
items:
12200+
$ref: '#/components/schemas/SplitVectorEntryItem'
12201+
minItems: 1
12202+
type: array
12203+
SplitVectorEntryItem:
12204+
description: The split graph list contains a graph for each value of the split
12205+
dimension.
12206+
minLength: 1
12207+
properties:
12208+
tag_key:
12209+
description: The tag key.
12210+
example: demo
12211+
minLength: 1
12212+
type: string
12213+
tag_values:
12214+
description: The tag values.
12215+
example:
12216+
- env
12217+
items:
12218+
minLength: 1
12219+
type: string
12220+
type: array
12221+
required:
12222+
- tag_key
12223+
- tag_values
12224+
type: object
1206112225
SuccessfulSignalUpdateResponse:
1206212226
description: Updated signal data following a successfully performed update.
1206312227
properties:
@@ -19540,30 +19704,31 @@ components:
1954019704
- $ref: '#/components/schemas/EventStreamWidgetDefinition'
1954119705
- $ref: '#/components/schemas/EventTimelineWidgetDefinition'
1954219706
- $ref: '#/components/schemas/FreeTextWidgetDefinition'
19707+
- $ref: '#/components/schemas/FunnelWidgetDefinition'
1954319708
- $ref: '#/components/schemas/GeomapWidgetDefinition'
1954419709
- $ref: '#/components/schemas/GroupWidgetDefinition'
1954519710
- $ref: '#/components/schemas/HeatMapWidgetDefinition'
1954619711
- $ref: '#/components/schemas/HostMapWidgetDefinition'
1954719712
- $ref: '#/components/schemas/IFrameWidgetDefinition'
1954819713
- $ref: '#/components/schemas/ImageWidgetDefinition'
19714+
- $ref: '#/components/schemas/ListStreamWidgetDefinition'
1954919715
- $ref: '#/components/schemas/LogStreamWidgetDefinition'
1955019716
- $ref: '#/components/schemas/MonitorSummaryWidgetDefinition'
1955119717
- $ref: '#/components/schemas/NoteWidgetDefinition'
1955219718
- $ref: '#/components/schemas/QueryValueWidgetDefinition'
1955319719
- $ref: '#/components/schemas/RunWorkflowWidgetDefinition'
19554-
- $ref: '#/components/schemas/ScatterPlotWidgetDefinition'
19555-
- $ref: '#/components/schemas/SLOWidgetDefinition'
1955619720
- $ref: '#/components/schemas/SLOListWidgetDefinition'
19721+
- $ref: '#/components/schemas/SLOWidgetDefinition'
19722+
- $ref: '#/components/schemas/ScatterPlotWidgetDefinition'
1955719723
- $ref: '#/components/schemas/ServiceMapWidgetDefinition'
1955819724
- $ref: '#/components/schemas/ServiceSummaryWidgetDefinition'
19725+
- $ref: '#/components/schemas/SplitGraphWidgetDefinition'
1955919726
- $ref: '#/components/schemas/SunburstWidgetDefinition'
1956019727
- $ref: '#/components/schemas/TableWidgetDefinition'
1956119728
- $ref: '#/components/schemas/TimeseriesWidgetDefinition'
1956219729
- $ref: '#/components/schemas/ToplistWidgetDefinition'
19563-
- $ref: '#/components/schemas/TreeMapWidgetDefinition'
19564-
- $ref: '#/components/schemas/ListStreamWidgetDefinition'
19565-
- $ref: '#/components/schemas/FunnelWidgetDefinition'
1956619730
- $ref: '#/components/schemas/TopologyMapWidgetDefinition'
19731+
- $ref: '#/components/schemas/TreeMapWidgetDefinition'
1956719732
WidgetDisplayType:
1956819733
description: Type of display to use for the request.
1956919734
enum:

.generator/src/generator/openapi.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,7 @@ def models(spec):
229229
def find_non_primitive_type(schema):
230230
if schema.get("enum"):
231231
return True
232-
sub_type = schema.get("type")
233-
if sub_type == "array":
234-
return find_non_primitive_type(schema["items"])
235-
return sub_type not in PRIMITIVE_TYPES
232+
return schema.get("type") not in PRIMITIVE_TYPES
236233

237234

238235
def get_references_for_model(model, model_name):
@@ -255,13 +252,13 @@ def get_references_for_model(model, model_name):
255252
result[name] = None
256253
else:
257254
items_name = formatter.get_name(definition.get("items"))
258-
if items_name and (
259-
find_non_primitive_type(definition["items"]) or formatter.is_list_model_whitelisted(items_name)
260-
):
261-
result[items_name] = None
262-
elif name and definition["items"].get("type") not in PRIMITIVE_TYPES:
263-
result[f"{name}Item"] = None
264-
255+
if items_name:
256+
if formatter.is_list_model_whitelisted(items_name):
257+
result[items_name] = None
258+
elif definition["items"].get("type") == "array":
259+
result[formatter.get_name(definition["items"]["items"])] = None
260+
elif find_non_primitive_type(definition["items"]):
261+
result[items_name] = None
265262
elif definition.get("properties") and top_name:
266263
result[top_name + formatter.camel_case(key)] = None
267264
if model.get("additionalProperties"):

docs/datadog_api_client.v1.model.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,6 +3452,69 @@ slo\_widget\_definition\_type
34523452
:members:
34533453
:show-inheritance:
34543454

3455+
split\_config
3456+
-------------
3457+
3458+
.. automodule:: datadog_api_client.v1.model.split_config
3459+
:members:
3460+
:show-inheritance:
3461+
3462+
split\_config\_sort\_compute
3463+
----------------------------
3464+
3465+
.. automodule:: datadog_api_client.v1.model.split_config_sort_compute
3466+
:members:
3467+
:show-inheritance:
3468+
3469+
split\_dimension
3470+
----------------
3471+
3472+
.. automodule:: datadog_api_client.v1.model.split_dimension
3473+
:members:
3474+
:show-inheritance:
3475+
3476+
split\_graph\_source\_widget\_definition
3477+
----------------------------------------
3478+
3479+
.. automodule:: datadog_api_client.v1.model.split_graph_source_widget_definition
3480+
:members:
3481+
:show-inheritance:
3482+
3483+
split\_graph\_viz\_size
3484+
-----------------------
3485+
3486+
.. automodule:: datadog_api_client.v1.model.split_graph_viz_size
3487+
:members:
3488+
:show-inheritance:
3489+
3490+
split\_graph\_widget\_definition
3491+
--------------------------------
3492+
3493+
.. automodule:: datadog_api_client.v1.model.split_graph_widget_definition
3494+
:members:
3495+
:show-inheritance:
3496+
3497+
split\_graph\_widget\_definition\_type
3498+
--------------------------------------
3499+
3500+
.. automodule:: datadog_api_client.v1.model.split_graph_widget_definition_type
3501+
:members:
3502+
:show-inheritance:
3503+
3504+
split\_sort
3505+
-----------
3506+
3507+
.. automodule:: datadog_api_client.v1.model.split_sort
3508+
:members:
3509+
:show-inheritance:
3510+
3511+
split\_vector\_entry\_item
3512+
--------------------------
3513+
3514+
.. automodule:: datadog_api_client.v1.model.split_vector_entry_item
3515+
:members:
3516+
:show-inheritance:
3517+
34553518
successful\_signal\_update\_response
34563519
------------------------------------
34573520

0 commit comments

Comments
 (0)