diff --git a/templates/go/model_enum.mustache b/templates/go/model_enum.mustache index 524701c..a5c8f93 100644 --- a/templates/go/model_enum.mustache +++ b/templates/go/model_enum.mustache @@ -1,5 +1,5 @@ // {{{classname}}} {{{description}}}{{^description}}the model '{{{classname}}}'{{/description}} -type {{{classname}}} {{{format}}}{{^format}}{{dataType}}{{/format}} +type {{{classname}}} {{dataType}} // List of {{{name}}} const ( @@ -22,7 +22,7 @@ var Allowed{{{classname}}}EnumValues = []{{{classname}}}{ } func (v *{{{classname}}}) UnmarshalJSON(src []byte) error { - var value {{{format}}}{{^format}}{{dataType}}{{/format}} + var value {{dataType}} err := json.Unmarshal(src, &value) if err != nil { return err @@ -45,7 +45,7 @@ func (v *{{{classname}}}) UnmarshalJSON(src []byte) error { // New{{{classname}}}FromValue returns a pointer to a valid {{{classname}}} // for the value passed as argument, or an error if the value passed is not allowed by the enum -func New{{{classname}}}FromValue(v {{{format}}}{{^format}}{{dataType}}{{/format}}) (*{{{classname}}}, error) { +func New{{{classname}}}FromValue(v {{dataType}}) (*{{{classname}}}, error) { ev := {{{classname}}}(v) if ev.IsValid() { return &ev, nil