using optional_field when autogenerating decoder #5082
Replies: 5 comments 7 replies
-
|
This change would mean that the decoder no longer matches the type definition. The decoder says the field can be absent and is nullable, but the type definition says it must be present but is nullable. |
Beta Was this translation helpful? Give feedback.
-
|
isn't nullable field implies that field can be absent? |
Beta Was this translation helpful? Give feedback.
-
|
As far as I remember, serde requires explicit specification of possibly missing values, using (Syntax may be slightly wrong) |
Beta Was this translation helpful? Give feedback.
-
i just checked, for the latest version of serde and serde_json, it traits fields of type Option as nullable and maybe absent, by default with no explicit specifications |
Beta Was this translation helpful? Give feedback.
-
No, it's one that can be |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
when generating decoder for a type, use optional_field by default for fields with option.Option(a) types
alternatively, add additional option for using optional_filed for that fields instead of regular field
example:
for that type
should be generated(or should be option to generate) this decoder
Beta Was this translation helpful? Give feedback.
All reactions