From 489ba81bd278231d3ebd04f64797c00f2c7e240d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Wed, 19 Feb 2025 15:44:04 +0100 Subject: [PATCH] fix: if a struct is empty it is an empty json object. Returning nil will break json marshalling --- templates/go/model_oneof.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/go/model_oneof.mustache b/templates/go/model_oneof.mustache index 8366014..649b03d 100644 --- a/templates/go/model_oneof.mustache +++ b/templates/go/model_oneof.mustache @@ -123,7 +123,7 @@ func (src {{classname}}) MarshalJSON() ([]byte, error) { } {{/oneOf}} - return nil, nil // no data in oneOf schemas + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object } // Get the actual instance