Describe the bug
If the payload is something like {"greeting":{}}, it marshals to {"greeting":}. If you take api-go as of this time and apply the following test patch you can see the error:
--- a/internal/temporalcommonv1/payload_json_test.go
+++ b/internal/temporalcommonv1/payload_json_test.go
@@ -82,6 +82,16 @@ var tests = []struct {
},
},
},
+}, {
+ name: "json/plain with empty object",
+ longformJSON: `{"metadata":{"encoding":"anNvbi9wcm90b2J1Zg=="},"data":"eyJncmVldGluZyI6IHt9fQ=="}`,
+ shorthandJSON: `{"greeting": {}}`,
+ pb: &common.Payload{
+ Metadata: map[string][]byte{
+ "encoding": []byte("json/plain"),
+ },
+ Data: []byte(`{"greeting":{}}`),
+ },
}}
func TestMaybeMarshal_ShorthandEnabled(t *testing.T) {
(sorry for opening in api repo, the api-go repo has issues disabled for good reason)