add a setting to be less fussy about `Option` fields where `null` is not allowed
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 57/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Rust
- Sterne
- 4
- Forks
- 4
- Ø Merge
- 15 Std. 16 Min.
- Gemergte PRs (30 T.)
- 26
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus oxidecomputer/typespace
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
oxidecomputer/typespace#47 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
add a setting to annotate generated types with its idEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 1/100
oxidecomputer/typespace#45 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 36/100
oxidecomputer/typespace#44 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
oxidecomputer/typespace#43 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
oxidecomputer/typespace#41 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in oxidecomputer/typespace
Ähnliche Issues
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedOffenunconfirmed possible issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
jerney-nexus/epikrise#364 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Yeachan-Heo/gajae-code#8058 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug daemon
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag