From b57849b64dd47e9d2f0a76857d32a502a1a70394 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Tue, 25 May 2021 12:57:47 +0200 Subject: [PATCH] Make optional params from 2946 optionals Add the `omitempty` annotation to `MSC2946SpacesRequest.ExcludeRooms` and `MSC2946SpacesRequest.MaxRoomsPerSpace` as MSC2946 states these are optional parameters (and keeping them around with their zero value might lead to type errors when interacting with other homeservers). See https://github.com/matrix-org/synapse/issues/10056 for more context. --- federationtypes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/federationtypes.go b/federationtypes.go index 3f6642ef..d1dc9b54 100644 --- a/federationtypes.go +++ b/federationtypes.go @@ -977,8 +977,8 @@ func (r *MSC2836EventRelationshipsResponse) UnmarshalJSON(data []byte) error { // MSC2946SpacesRequest is the HTTP body for the federated /unstable/spaces/{roomID} endpoint // See https://github.com/matrix-org/matrix-doc/pull/2946 type MSC2946SpacesRequest struct { - ExcludeRooms []string `json:"exclude_rooms"` - MaxRoomsPerSpace int `json:"max_rooms_per_space"` + ExcludeRooms []string `json:"exclude_rooms,omitempty"` + MaxRoomsPerSpace int `json:"max_rooms_per_space,omitempty"` Limit int `json:"limit"` Batch string `json:"batch"` }