Skip to content

Commit 37a2da6

Browse files
authored
fix: remove special handling for format tag in enums that lead to broken code (#125)
1 parent c8c52cf commit 37a2da6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/go/model_enum.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {{{classname}}} {{{description}}}{{^description}}the model '{{{classname}}}'{{/description}}
2-
type {{{classname}}} {{{format}}}{{^format}}{{dataType}}{{/format}}
2+
type {{{classname}}} {{dataType}}
33

44
// List of {{{name}}}
55
const (
@@ -22,7 +22,7 @@ var Allowed{{{classname}}}EnumValues = []{{{classname}}}{
2222
}
2323

2424
func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {
25-
var value {{{format}}}{{^format}}{{dataType}}{{/format}}
25+
var value {{dataType}}
2626
err := json.Unmarshal(src, &value)
2727
if err != nil {
2828
return err
@@ -45,7 +45,7 @@ func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {
4545

4646
// New{{{classname}}}FromValue returns a pointer to a valid {{{classname}}}
4747
// for the value passed as argument, or an error if the value passed is not allowed by the enum
48-
func New{{{classname}}}FromValue(v {{{format}}}{{^format}}{{dataType}}{{/format}}) (*{{{classname}}}, error) {
48+
func New{{{classname}}}FromValue(v {{dataType}}) (*{{{classname}}}, error) {
4949
ev := {{{classname}}}(v)
5050
if ev.IsValid() {
5151
return &ev, nil

0 commit comments

Comments
 (0)