Skip to content

Commit 55d5321

Browse files
committed
client-api: Always serialize the search results field.
It was skipped when empty, so a search response whose final page has no results omitted the field entirely. Clients expect it to always be present. Signed-off-by: Jason Volk <jason@zemos.net>
1 parent c418db9 commit 55d5321

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

crates/ruma-client-api/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Bug fixes:
2828

2929
- Fix `sync_events::v5::Request::set_presence` being read from / serialized to
3030
the JSON body instead of the query string.
31+
- Serialize the `results` field of `search_events` responses even when empty,
32+
so clients can rely on the key being present.
3133

3234
[MSC4383]: https://github.com/matrix-org/matrix-spec-proposals/pull/4383
3335

crates/ruma-client-api/src/search/search_events.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ pub mod v3 {
369369
pub next_batch: Option<String>,
370370

371371
/// List of results in the requested order.
372-
#[serde(default, skip_serializing_if = "Vec::is_empty")]
372+
///
373+
/// Serialized even when empty so that clients can rely on the field being present.
374+
#[serde(default)]
373375
pub results: Vec<SearchResult>,
374376

375377
/// The current state for every room in the results.

0 commit comments

Comments
 (0)