Skip to content

Commit 4d5db4d

Browse files
committed
fix linting
1 parent 415fc53 commit 4d5db4d

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

languages/golang/compat-layer/templates/field_type.mustache

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Upstream Go codegen ignores `nullable: true` inside additionalProperties when
44
computing the map value type, producing `map[string]string` instead of
55
`map[string]*string`. This partial restores the missing `*` on the map value
6-
when the additionalProperties schema is nullable, and otherwise emits
7-
the upstream-computed dataType unchanged.
8-
}}{{#isMap}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}
6+
when the additionalProperties schema is nullable AND the schema is a typed map
7+
(not a free-form object, where dataType is already `map[string]interface{}`
8+
and pointer-wrapping the value would produce `map[string]*interface{}`).
9+
Otherwise it emits the upstream-computed dataType unchanged.
10+
}}{{#isMap}}{{^isFreeFormObject}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isFreeFormObject}}{{#isFreeFormObject}}{{{dataType}}}{{/isFreeFormObject}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}

languages/golang/templates/field_type.mustache

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Upstream Go codegen ignores `nullable: true` inside additionalProperties when
44
computing the map value type, producing `map[string]string` instead of
55
`map[string]*string`. This partial restores the missing `*` on the map value
6-
when the additionalProperties schema is nullable, and otherwise emits
7-
the upstream-computed dataType unchanged.
8-
}}{{#isMap}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}
6+
when the additionalProperties schema is nullable AND the schema is a typed map
7+
(not a free-form object, where dataType is already `map[string]interface{}`
8+
and pointer-wrapping the value would produce `map[string]*interface{}`).
9+
Otherwise it emits the upstream-computed dataType unchanged.
10+
}}{{#isMap}}{{^isFreeFormObject}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{{dataType}}}{{/additionalProperties.isNullable}}{{/isFreeFormObject}}{{#isFreeFormObject}}{{{dataType}}}{{/isFreeFormObject}}{{/isMap}}{{^isMap}}{{{dataType}}}{{/isMap}}
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{{!
22
Renders the Go base (unwrapped) type for a property, accounting for nullable
33
additionalProperties. Used in getter/setter signatures where upstream emits
4-
the vendor base type. For map types whose additionalProperties schema is
4+
the vendor base type. For typed maps whose additionalProperties schema is
55
nullable, upstream ignores nullable=true and produces map[string]string
6-
instead of map[string]*string. This partial restores the missing pointer
7-
in that case, and otherwise emits the upstream base type unchanged.
8-
}}{{#isMap}}{{#additionalProperties.isNullable}}map[string]*{{{additionalProperties.dataType}}}{{/additionalProperties.isNullable}}{{^additionalProperties.isNullable}}{{vendorExtensions.x-go-base-type}}{{/additionalProperties.isNullable}}{{/isMap}}{{^isMap}}{{vendorExtensions.x-go-base-type}}{{/isMap}}
6+
instead of map[string]*string. This partial restores the missing pointer in
7+
that case. Free-form objects (`additionalProperties: true` -> dataType
8+
`map[string]interface{}`) are excluded so we don't produce
9+
`map[string]*interface{}`. Otherwise the upstream base type is emitted
10+
unchanged.
11+
}}{{#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}}

0 commit comments

Comments
 (0)