diff options
| author | mat <git@matdoes.dev> | 2025-12-27 08:41:22 -1345 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-12-27 08:41:22 -1345 |
| commit | e63b86ddad694073029e33bb54296f3c2b3375be (patch) | |
| tree | a6d01d8421ffed250bf9a474d2e820062d2f603f | |
| parent | aae744918e26c505e0932a65624c4aac65815d19 (diff) | |
| download | azalea-drasl-e63b86ddad694073029e33bb54296f3c2b3375be.tar.xz | |
don't serialize 'extra' twice in FormattedText
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | azalea-chat/src/text_component.rs | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fff077..33037c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ is breaking anyways, semantic versioning is not followed. ### Fixed +- Serializing `FormattedText` with serde was writing `extra` twice. + ## [0.15.0+mc1.21.11] - 2025-12-18 ### Added diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs index ec89a7c9..41f03965 100644 --- a/azalea-chat/src/text_component.rs +++ b/azalea-chat/src/text_component.rs @@ -28,9 +28,6 @@ impl Serialize for TextComponent { self.base.serialize_map::<S>(&mut state)?; - if !self.base.siblings.is_empty() { - state.serialize_entry("extra", &self.base.siblings)?; - } state.end() } } @@ -254,4 +251,13 @@ mod tests { ) ); } + + #[test] + fn test_serialize_to_json() { + let component = TextComponent::new("Hello §aworld".to_owned()).get(); + assert_eq!( + serde_json::to_string(&component).unwrap(), + "{\"text\":\"\",\"extra\":[\"Hello \",{\"text\":\"world\",\"color\":\"#55FF55\"}]}" + ); + } } |
