add a setting to be less fussy about `Option` fields where `null` is not allowed
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading the code that renders optional properties as Rust Option<T> fields and the tests covering their generated serde attributes. Add the optional_value setting with RejectNull as the default and AllowNull producing a plain Option<T> with the skip attribute. Done when tests confirm both variants generate the described code.
由索引模型根据 Issue 内容生成。
描述
An Optional property (whose type is not an Option, a container, or the
unit type) renders as Option<T> with deserialize_some:
#[serde(
default,
deserialize_with = "::json_serde::deserialize_some",
skip_serializing_if = "::std::option::Option::is_none"
)]
pub value: ::std::option::Option<i64>,
An absend field serializes as None and null is an error. And that's
accurate! While a bare Option<T> permits null, an Optional property is
merely optional, not nullable.
However, not all people are quite as fussy, and they're used to reading
imprecise Rust code that looks like this:
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<i64>,
To produce code more like that, we can add a setting: optional_value with two
variants:
RejectNull: the rendering above. Precise, accurate and the default; it's
what typespace does today.AllowNull: a plainOption<T>with just the skip, which is serde's own
behavior--absent andnullare bothNone.
- 主要语言
- Rust
- 星标
- 4
- 派生
- 4
- 平均合并
- 15 小时 16 分钟
- 30 天内合并 PR
- 26
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oxidecomputer/typespace 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
oxidecomputer/typespace#47 · 1 条评论 ·
维护者通常 1 天内回复
-
add a setting to annotate generated types with its id可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 1/100
oxidecomputer/typespace#45 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 36/100
oxidecomputer/typespace#44 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
oxidecomputer/typespace#43 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
oxidecomputer/typespace#41 ·
维护者通常 1 天内回复
查看 oxidecomputer/typespace 的全部 Issue
相似的 Issue
-
area: cli good first issue type: feature
难度 2/5 1-3 小时 新手友好度 78/100
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
renaming a provider to a taken name fails with a raw sql error可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:storage kind:bug priority:p3 ready
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug bugfix
难度 2/5 1-3 小时 新手友好度 72/100
storytold/photocraft#16975 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复