diff --git a/examples/go-json-tags/__snapshots__/index.spec.ts.snap b/examples/go-json-tags/__snapshots__/index.spec.ts.snap index 3f1ddc2de8..fb55f5d97a 100644 --- a/examples/go-json-tags/__snapshots__/index.spec.ts.snap +++ b/examples/go-json-tags/__snapshots__/index.spec.ts.snap @@ -4,8 +4,8 @@ exports[`Should be able to render json-tags in struct and should log expected ou Array [ "// Root represents a Root model. type Root struct { - Cities *Cities \`json:\\"cities, omitempty\\"\` - Options *Options \`json:\\"options, omitempty\\"\` + Cities *Cities \`json:\\"cities,omitempty\\"\` + Options *Options \`json:\\"options,omitempty\\"\` }", ] `; diff --git a/src/generators/go/presets/CommonPreset.ts b/src/generators/go/presets/CommonPreset.ts index 248a7b5f6c..628b1b5d38 100644 --- a/src/generators/go/presets/CommonPreset.ts +++ b/src/generators/go/presets/CommonPreset.ts @@ -19,9 +19,9 @@ function renderJSONTag({ field.property instanceof ConstrainedDictionaryModel && field.property.serializationType === 'unwrap' ) { - return `json:"-"`; + return `json:"-",omitempty`; } - return `json:"${field.unconstrainedPropertyName}, omitempty"`; + return `json:"${field.unconstrainedPropertyName},omitempty"`; } function renderMarshallingFunctions({ diff --git a/test/generators/go/presets/__snapshots__/CommonPreset.spec.ts.snap b/test/generators/go/presets/__snapshots__/CommonPreset.spec.ts.snap index 6a1819d052..0d35ec5083 100644 --- a/test/generators/go/presets/__snapshots__/CommonPreset.spec.ts.snap +++ b/test/generators/go/presets/__snapshots__/CommonPreset.spec.ts.snap @@ -3,9 +3,9 @@ exports[`GO_COMMON_PRESET should render json tags for structs 1`] = ` "// Root represents a Root model. type Root struct { - StringProp string \`json:\\"stringProp, omitempty\\"\` - NumberProp float64 \`json:\\"numberProp, omitempty\\"\` - BooleanProp bool \`json:\\"booleanProp, omitempty\\"\` + StringProp string \`json:\\"stringProp,omitempty\\"\` + NumberProp float64 \`json:\\"numberProp,omitempty\\"\` + BooleanProp bool \`json:\\"booleanProp,omitempty\\"\` }" `;