You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(generator): empty additionalProperties treated as falsy, breaking nullable map example generation (AAWF-1198) (#3952)
* fix(formatter): handle empty additionalProperties as map[string]interface{}
When `additionalProperties: {}` is set on a schema, Python's truthiness
evaluates the empty dict as falsy, causing the additionalProperties block
to be skipped. The generator then fell through to the nullable path and
emitted `*NewNullableXxx(&Xxx{})` — a constructor that is never generated
for map schemas — resulting in a Go compile error.
Fix the condition to check for the presence of the key and an explicit
`false` value rather than relying on truthiness. When additionalProperties
is an empty dict or boolean `true`, normalize to `interface{}` as the
nested value type and format values inline.
Also remove the now-unreachable dead-code branch that previously handled
`type: object + additionalProperties: {}` after the nullable check.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* pre-commit fixes
* fix(formatter): properly escape values in untyped additionalProperties
When formatting values for untyped additionalProperties (e.g. additionalProperties: {}),
infer the schema from the Python value type so that string escaping, boolean and
number formatting are handled correctly. Previously, the fallback `f'"{v}"'` would
embed raw newlines in Go string literals, causing compile errors for values like
multi-line strings.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* pre-commit fixes
* fix(formatter): use map type for named map schemas in array items
When array items are a $ref to a schema with additionalProperties (and
no properties), schema_name() returned the ref name (e.g.
IDPConfigValueItem) which was used as the Go type — but no struct is
ever generated for map schemas, causing a compile error.
Apply the same additionalProperties != False guard used elsewhere so
that named map schemas resolve to map[string]T instead of the struct
name, consistent with how type_to_go() handles them.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
0 commit comments