From 3caefd6716ff29e204c0aeec80887a65965df90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 19:31:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90=20kind=20?= =?UTF-8?q?=E8=BD=AC=E4=B9=89=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=8F=8D=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为 AssetKindVisitor 增加 visit_string 转发。 补充 JSON 转义 kind 的反序列化回归测试。 --- .../src/game_creation_app/asset_kind.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server-rs/crates/shared-contracts/src/game_creation_app/asset_kind.rs b/server-rs/crates/shared-contracts/src/game_creation_app/asset_kind.rs index 5638a299a..6d38774d2 100644 --- a/server-rs/crates/shared-contracts/src/game_creation_app/asset_kind.rs +++ b/server-rs/crates/shared-contracts/src/game_creation_app/asset_kind.rs @@ -192,6 +192,13 @@ impl<'de> Deserialize<'de> for GameCreationAppAssetKind { { Ok(GameCreationAppAssetKind::parse_with_context(value, "serde")) } + + fn visit_string(self, value: String) -> Result + where + E: de::Error, + { + self.visit_str(&value) + } } deserializer.deserialize_str(AssetKindVisitor) @@ -242,4 +249,12 @@ mod tests { ); } } + + #[test] + fn escaped_wire_strings_are_deserialized() { + assert_eq!( + serde_json::from_str::(r#""ui\u002Ddesign""#).unwrap(), + GameCreationAppAssetKind::Unknown + ); + } }