Skip to content

Commit

Permalink
feat: pointer-ize model optional properties
Browse files Browse the repository at this point in the history
Make model optional value be pointer to enable distinguish
omitting JSON fields and Go zero values.

This approach cannot distinguish NotSet and Null.
See: <OpenAPITools/openapi-generator#522>

BREAKING CHANGE: model optional properties are pointer-ize,
so partial model property types will be changed.
  • Loading branch information
KoharaKazuya committed Mar 26, 2019
1 parent 41d2dd2 commit 879338d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ const (
type {{classname}} struct {
{{#vars}}{{#description}}
// {{{description}}}{{/description}}
{{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
{{name}} {{#isNullable}}*{{/isNullable}}{{^isNullable}}{{^required}}*{{/required}}{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
{{/vars}}
}{{/isEnum}}{{/model}}{{/models}}

0 comments on commit 879338d

Please sign in to comment.