Closed mtkennerly closed 1 year ago
I realized that it also works if I just remove the #[serde(default, with = "rust_decimal::serde::float_option")]
line altogether. Maybe this is just an issue with the Serde attributes disabling some internal behavior when they're present.
I'd like to reopen the issue, it seems to relate to str_option
too
Indeed, removing the attribute helps, but it becomes an issue again when one needs to use multiple Serde features and different #[serde(with = ...)]
options (e.g. serde-with-str
for one struct and serde-float
for another)
This is a really annoying limitation of serde that's bitten me multiple times. When using certain tagging representations or using flatten, serde loses the information on what types it's working with.
Serde has refused to implement any proposed solutions, so for now I'm afraid this will just have to be worked around by changing you serialisation format.
I don't expect this will be fixed until a mythical serde 2.0 comes out.
Hi! I just ran into this issue where
null
fails to parse when it's inside of an internally tagged enum.Cargo.toml:
main.rs:
Output:
It works fine with a struct instead: