From f7ea99978d39dbfe48620ff82df8e9ebe8aafbbb Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 23 May 2022 14:26:11 +0100 Subject: [PATCH] Specify `omitempty` for some fields in `DeviceListUpdateEvent` (#311) This should address the cause of matrix-org/synapse#12829. These fields are optional, so we should omit them if they are empty instead of sending `null`. --- device_update.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/device_update.go b/device_update.go index e4ea1b70..c636ccb5 100644 --- a/device_update.go +++ b/device_update.go @@ -6,9 +6,9 @@ import "encoding/json" type DeviceListUpdateEvent struct { UserID string `json:"user_id"` DeviceID string `json:"device_id"` - DeviceDisplayName string `json:"device_display_name"` + DeviceDisplayName string `json:"device_display_name,omitempty"` StreamID int64 `json:"stream_id"` - PrevID []int64 `json:"prev_id"` - Deleted bool `json:"deleted"` - Keys json.RawMessage `json:"keys"` + PrevID []int64 `json:"prev_id,omitempty"` + Deleted bool `json:"deleted,omitempty"` + Keys json.RawMessage `json:"keys,omitempty"` }