Skip to content

Commit 0ec3a12

Browse files
authored
Don't build models for nullable (#1046)
While technically it works because of a trick in the new method, it's a bit confusing when the method needs extra arguments.
1 parent 78014e9 commit 0ec3a12

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

.generator/src/generator/formatter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def format_data_with_schema(
191191
else:
192192
if schema.get("nullable") and data is None:
193193
parameters = repr(data)
194+
return parameters, imports
194195
else:
195196

196197
def format_datetime(x):

examples/v1/notebooks/CreateNotebook.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from datadog_api_client.v1.api.notebooks_api import NotebooksApi
77
from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest
88
from datadog_api_client.v1.model.notebook_cell_resource_type import NotebookCellResourceType
9-
from datadog_api_client.v1.model.notebook_cell_time import NotebookCellTime
109
from datadog_api_client.v1.model.notebook_create_data import NotebookCreateData
1110
from datadog_api_client.v1.model.notebook_create_data_attributes import NotebookCreateDataAttributes
1211
from datadog_api_client.v1.model.notebook_create_request import NotebookCreateRequest
@@ -67,7 +66,7 @@
6766
keys=[],
6867
tags=[],
6968
),
70-
time=NotebookCellTime(None),
69+
time=None,
7170
),
7271
type=NotebookCellResourceType("notebook_cells"),
7372
),

examples/v1/notebooks/UpdateNotebook.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from datadog_api_client.v1.api.notebooks_api import NotebooksApi
88
from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest
99
from datadog_api_client.v1.model.notebook_cell_resource_type import NotebookCellResourceType
10-
from datadog_api_client.v1.model.notebook_cell_time import NotebookCellTime
1110
from datadog_api_client.v1.model.notebook_graph_size import NotebookGraphSize
1211
from datadog_api_client.v1.model.notebook_markdown_cell_attributes import NotebookMarkdownCellAttributes
1312
from datadog_api_client.v1.model.notebook_markdown_cell_definition import NotebookMarkdownCellDefinition
@@ -71,7 +70,7 @@
7170
keys=[],
7271
tags=[],
7372
),
74-
time=NotebookCellTime(None),
73+
time=None,
7574
),
7675
type=NotebookCellResourceType("notebook_cells"),
7776
),

examples/v2/incidents/UpdateIncident_1009194038.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from datadog_api_client.v2.model.incident_update_relationships import IncidentUpdateRelationships
1111
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest
1212
from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser
13-
from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData
1413

1514
# there is a valid "incident" in the system
1615
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]
@@ -21,7 +20,7 @@
2120
type=IncidentType("incidents"),
2221
relationships=IncidentUpdateRelationships(
2322
commander_user=NullableRelationshipToUser(
24-
data=NullableRelationshipToUserData(None),
23+
data=None,
2524
),
2625
),
2726
),

0 commit comments

Comments
 (0)