Skip to content

Commit 67bdbcd

Browse files
authored
fix: if a struct is empty it is an empty json object. Returning nil will break json marshalling (#132)
1 parent 564c310 commit 67bdbcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/go/model_oneof.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (src {{classname}}) MarshalJSON() ([]byte, error) {
123123
}
124124

125125
{{/oneOf}}
126-
return nil, nil // no data in oneOf schemas
126+
return []byte("{}"), nil // no data in oneOf schemas => empty JSON object
127127
}
128128

129129
// Get the actual instance

0 commit comments

Comments
 (0)