.generator/src/generator/openapi.py in datadog_api_client-1.9.0 vs .generator/src/generator/openapi.py in datadog_api_client-1.10.0
- old
+ new
@@ -30,11 +30,11 @@
"""Return Ruby type name for the type."""
name = get_name(schema)
if name:
if "enum" in schema:
return name
- if not schema.get("additionalProperties") and schema.get("type", "object") == "object":
+ if not (schema.get("additionalProperties") and not schema.get("properties")) and schema.get("type", "object") == "object":
return name
type_ = schema.get("type")
if type_ is None:
if "items" in schema:
@@ -57,13 +57,13 @@
return "File"
return "String"
elif type_ == "boolean":
return "Boolean"
elif type_ == "array":
- return "Array<{}>".format(type_to_ruby(schema["items"]))
+ return "Array<{}>".format(type_to_ruby(schema["items"], name + "Item" if name else None))
elif type_ == "object":
- if "additionalProperties" in schema:
+ if "additionalProperties" in schema and not schema.get("properties"):
return "Hash<String, {}>".format(type_to_ruby(schema["additionalProperties"]))
return (
alternative_name
if alternative_name
and ("properties" in schema or "oneOf" in schema or "anyOf" in schema or "allOf" in schema)
@@ -111,16 +111,16 @@
yield from child_models(child, seen=seen)
if "items" in schema:
yield from child_models(
schema["items"],
- alternative_name=alternative_name + "Item" if alternative_name is not None else None,
+ alternative_name=name + "Item" if name is not None else None,
seen=seen,
)
if (
schema.get("type") == "object" or "properties" in schema or has_sub_models
- ) and "additionalProperties" not in schema:
+ ) and not ("additionalProperties" in schema and "properties" not in schema):
if not has_sub_models and name is None:
# this is a basic map object so we don't need a type
return
if name is None: