Skip to content

Commit

Permalink
Don't build models for nullable (#1046)
Browse files Browse the repository at this point in the history
While technically it works because of a trick in the new method, it's a
bit confusing when the method needs extra arguments.
  • Loading branch information
therve authored Jun 13, 2022
1 parent 78014e9 commit 0ec3a12
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions .generator/src/generator/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def format_data_with_schema(
else:
if schema.get("nullable") and data is None:
parameters = repr(data)
return parameters, imports
else:

def format_datetime(x):
Expand Down
3 changes: 1 addition & 2 deletions examples/v1/notebooks/CreateNotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from datadog_api_client.v1.api.notebooks_api import NotebooksApi
from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest
from datadog_api_client.v1.model.notebook_cell_resource_type import NotebookCellResourceType
from datadog_api_client.v1.model.notebook_cell_time import NotebookCellTime
from datadog_api_client.v1.model.notebook_create_data import NotebookCreateData
from datadog_api_client.v1.model.notebook_create_data_attributes import NotebookCreateDataAttributes
from datadog_api_client.v1.model.notebook_create_request import NotebookCreateRequest
Expand Down Expand Up @@ -67,7 +66,7 @@
keys=[],
tags=[],
),
time=NotebookCellTime(None),
time=None,
),
type=NotebookCellResourceType("notebook_cells"),
),
Expand Down
3 changes: 1 addition & 2 deletions examples/v1/notebooks/UpdateNotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from datadog_api_client.v1.api.notebooks_api import NotebooksApi
from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest
from datadog_api_client.v1.model.notebook_cell_resource_type import NotebookCellResourceType
from datadog_api_client.v1.model.notebook_cell_time import NotebookCellTime
from datadog_api_client.v1.model.notebook_graph_size import NotebookGraphSize
from datadog_api_client.v1.model.notebook_markdown_cell_attributes import NotebookMarkdownCellAttributes
from datadog_api_client.v1.model.notebook_markdown_cell_definition import NotebookMarkdownCellDefinition
Expand Down Expand Up @@ -71,7 +70,7 @@
keys=[],
tags=[],
),
time=NotebookCellTime(None),
time=None,
),
type=NotebookCellResourceType("notebook_cells"),
),
Expand Down
3 changes: 1 addition & 2 deletions examples/v2/incidents/UpdateIncident_1009194038.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from datadog_api_client.v2.model.incident_update_relationships import IncidentUpdateRelationships
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest
from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser
from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]
Expand All @@ -21,7 +20,7 @@
type=IncidentType("incidents"),
relationships=IncidentUpdateRelationships(
commander_user=NullableRelationshipToUser(
data=NullableRelationshipToUserData(None),
data=None,
),
),
),
Expand Down

0 comments on commit 0ec3a12

Please sign in to comment.