Skip to content

Commit 483249c

Browse files
jirikuncarci.datadog-api-spec
andauthored
Fix generation of oneOf types (#921)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 51d380b commit 483249c

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.generator/src/generator/openapi.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def get_oneof_parameters(model):
250250

251251
def get_oneof_types(model):
252252
for schema in model["oneOf"]:
253-
type_ = schema.get("type")
253+
type_ = schema.get("type", "object")
254254
if type_ in ("array", "object"):
255255
yield formatter.get_name(schema)
256256
elif type_ == "integer":
@@ -259,12 +259,16 @@ def get_oneof_types(model):
259259
yield "str"
260260
elif type_ == "number":
261261
yield "float"
262+
elif type_ == "boolean":
263+
yield "bool"
264+
else:
265+
raise NotImplementedError(f"Type {type_} not implemented")
262266

263267

264268
def get_oneof_models(model):
265269
result = []
266270
for schema in model["oneOf"]:
267-
if schema.get("type") in ("array", "object"):
271+
if schema.get("type", "object") in ("array", "object"):
268272
result.append(formatter.get_name(schema))
269273
return result
270274

src/datadog_api_client/v1/model/sunburst_widget_legend.py

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datadog_api_client/v2/model/logs_group_by_total.py

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)