From e30360dd4c98c9eafc2332a4b914072493b98eec Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 16 Nov 2023 10:28:49 +0100 Subject: [PATCH] client-api: Fix deserialization of `claim_keys` responses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … without a `failures` field. --- crates/ruma-client-api/CHANGELOG.md | 4 ++++ crates/ruma-client-api/src/keys/claim_keys/v3.rs | 1 + crates/ruma-client-api/src/keys/claim_keys/v4.rs | 1 + 3 files changed, 6 insertions(+) diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index bc19e643..03263b00 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -1,5 +1,9 @@ # [unreleased] +Bug fixes: + +- Fix deserialization of `claim_keys` responses without a `failures` field + # 0.17.2 Improvements: diff --git a/crates/ruma-client-api/src/keys/claim_keys/v3.rs b/crates/ruma-client-api/src/keys/claim_keys/v3.rs index bd063f55..5d4faa2f 100644 --- a/crates/ruma-client-api/src/keys/claim_keys/v3.rs +++ b/crates/ruma-client-api/src/keys/claim_keys/v3.rs @@ -44,6 +44,7 @@ pub struct Request { pub struct Response { /// If any remote homeservers could not be reached, they are recorded here. /// The names of the properties are the names of the unreachable servers. + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub failures: BTreeMap, /// One-time keys for the queried devices. diff --git a/crates/ruma-client-api/src/keys/claim_keys/v4.rs b/crates/ruma-client-api/src/keys/claim_keys/v4.rs index ef7948f7..4fd9b100 100644 --- a/crates/ruma-client-api/src/keys/claim_keys/v4.rs +++ b/crates/ruma-client-api/src/keys/claim_keys/v4.rs @@ -43,6 +43,7 @@ pub struct Request { pub struct Response { /// If any remote homeservers could not be reached, they are recorded here. /// The names of the properties are the names of the unreachable servers. + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub failures: BTreeMap, /// One-time keys for the queried devices.