Is it as expect that Option attribute serialize into empty string instead of non-attribute.
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
The example uses quick_xml::se::to_string and a Serde Option<usize> renamed to @foo. Start by reading the serializer’s handling of optional values and attributes, then check existing serialization tests for None. Done means determining whether None should omit the attribute or serialize it as an empty string, and adding a regression test for the agreed behavior.
由索引模型根据 Issue 内容生成。
描述
A simple example here.
use serde::Serialize;
use quick_xml::se::to_string;
#[derive(Serialize)]
struct Foo {
#[serde(rename = "@foo")]
foo: Option<usize>
}
#[test]
fn test_foo() {
let foo = Foo { foo: None };
let foo_xml = to_string(&foo).unwrap();
assert_eq!(foo_xml, "<Foo foo=\"\"/>");
assert_eq!(foo_xml, "<Foo/>");
}
Is foo="" expected in quick-xml instead of dismissing this attribute?
- 主要语言
- Rust
- 星标
- 1.6k
- 派生
- 299
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tafia/quick-xml 的其他 Issue
-
Parser accepts an empty element or attribute name可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
DecodingReader::set_encoding panics when the XML declaration is longer than 64 bytes可能已有人在做 @emschwartz 于 5 天前认领。 未关闭bug encoding
难度 4/5 3-5 天 新手友好度 30/100
tafia/quick-xml#1040 · 1 条评论 ·
维护者通常 1 天内回复
-
encoding optimization
难度 4/5 3-5 天 新手友好度 55/100
tafia/quick-xml#1039 · 1 条评论 ·
维护者通常 1 天内回复
-
optimization question
难度 4/5 3-5 天 新手友好度 52/100
维护者通常 1 天内回复
-
enhancement
难度 4/5 1-2 天 新手友好度 53/100
tafia/quick-xml#1035 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
comp-rbac
难度 2/5 1-3 小时 新手友好度 68/100
ClickHouse/ClickHouse#131875 ·
维护者通常 1 天内回复
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indices可能已有人在做 @Borg93 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
lance-format/lance#11117 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
storytold/photocraft#15232 · 1 条评论 ·
维护者通常 1 天内回复
-
forge: fork preflight reads still send `requireCanonical: false`, which Rootstock rejects (-32603)可能已有人在做 @Ynyesto 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
foundry-rs/foundry#18485 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
bondybondbond/rushcut#238 · 1 条评论 ·