File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change
1
+
1
2
//model_oneof.mustache
2
3
// { {classname} } - { {{description} }}{ {^description} }struct for { {{classname} }}{ {/description} }
3
4
type { {classname} } struct {
@@ -59,8 +60,8 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
59
60
// try to unmarshal data into { {#lambda.type-to-name} }{ {{.} }}{ {/lambda.type-to-name} }
60
61
err = json.Unmarshal(data, &dst.{ {#lambda.type-to-name} }{ {{.} }}{ {/lambda.type-to-name} })
61
62
if err == nil {
62
- json{{{. } }}, _ := json.Marshal(dst.{ {#lambda.type-to-name} }{ {{.} }}{ {/lambda.type-to-name} })
63
- if string(json{ {{. } }}) == "{ } " { // empty struct
63
+ json{{#lambda.type-to-name } } { {{. } }} { {/lambda.type-to-name } }, _ := json.Marshal(dst.{ {#lambda.type-to-name} }{ {{.} }}{ {/lambda.type-to-name} })
64
+ if string(json{ {#lambda.type-to-name } } { {{. } }} { {/lambda.type-to-name } }) == "{ } " { // empty struct
64
65
dst.{{#lambda.type-to-name} }{ {{.} }}{ {/lambda.type-to-name} } = nil
65
66
} else {
66
67
match++
@@ -142,4 +143,4 @@ func (obj *{{classname}}) GetActualInstance() (interface{}) {
142
143
return nil
143
144
}
144
145
145
- { {> nullable_model} }
146
+ { {> nullable_model} }
You can’t perform that action at this time.
0 commit comments