Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions languages/golang/compat-layer/templates/field_type.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{!
Renders the Go type for a property, accounting for nullable additionalProperties.
Upstream Go codegen ignores `nullable: true` inside additionalProperties when
computing the map value type, producing `map[string]string` instead of
`map[string]*string`. This partial restores the missing `*` on the map value
when the additionalProperties schema is nullable AND the schema is a typed map
(not a free-form object, where dataType is already `map[string]interface{}`
and pointer-wrapping the value would produce `map[string]*interface{}`).
Otherwise it emits the upstream-computed dataType unchanged.
}}{{#isMap}}{{^isFreeFormObject}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isFreeFormObject}}{{#isFreeFormObject}}{{{dataType}}}{{/isFreeFormObject}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,11 @@ func set{{classname}}{{getter}}AttributeType(arg *{{classname}}{{getter}}Attribu
{{^isArray}}
// isContainer
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}}{{getter}}AttributeType = *{{dataType}}
type {{classname}}{{getter}}AttributeType = *{{>field_type}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}}{{getter}}ArgType = {{#isNullable}}*{{/isNullable}}{{dataType}}
type {{classname}}{{getter}}ArgType = {{#isNullable}}*{{/isNullable}}{{>field_type}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}}{{getter}}RetType = {{#isNullable}}*{{/isNullable}}{{dataType}}
type {{classname}}{{getter}}RetType = {{#isNullable}}*{{/isNullable}}{{>field_type}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func get{{classname}}{{getter}}AttributeTypeOk(arg {{classname}}{{getter}}AttributeType) (ret {{classname}}{{getter}}RetType, ok bool) {
if arg == nil {
Expand Down
10 changes: 10 additions & 0 deletions languages/golang/templates/field_type.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{!
Renders the Go type for a property, accounting for nullable additionalProperties.
Upstream Go codegen ignores `nullable: true` inside additionalProperties when
computing the map value type, producing `map[string]string` instead of
`map[string]*string`. This partial restores the missing `*` on the map value
when the additionalProperties schema is nullable AND the schema is a typed map
(not a free-form object, where dataType is already `map[string]interface{}`
and pointer-wrapping the value would produce `map[string]*interface{}`).
Otherwise it emits the upstream-computed dataType unchanged.
}}{{#isMap}}{{^isFreeFormObject}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isFreeFormObject}}{{#isFreeFormObject}}{{{dataType}}}{{/isFreeFormObject}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}
11 changes: 11 additions & 0 deletions languages/golang/templates/field_type_base.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{!
Renders the Go base (unwrapped) type for a property, accounting for nullable
additionalProperties. Used in getter/setter signatures where upstream emits
the vendor base type. For typed maps whose additionalProperties schema is
nullable, upstream ignores nullable=true and produces map[string]string
instead of map[string]*string. This partial restores the missing pointer in
that case. Free-form objects (`additionalProperties: true` -> dataType
`map[string]interface{}`) are excluded so we don't produce
`map[string]*interface{}`. Otherwise the upstream base type is emitted
unchanged.
}}{{#isMap}}{{^isFreeFormObject}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{vendorExtensions.x-go-base-type}}{{/additionalProperties.isNullable}}{{/isFreeFormObject}}{{#isFreeFormObject}}{{vendorExtensions.x-go-base-type}}{{/isFreeFormObject}}{{/isMap}}{{^isMap}}{{vendorExtensions.x-go-base-type}}{{/isMap}}
Loading
Loading