Closed sivizius closed 4 months ago
Thanks for finding this problem. Indeed, deserialize_with
for schemars
is not supported. It seems that serialize_with
is only "supported" in that it doesn't cause compilation failures, but it won't change the generated schema. The problem is fixed in v3.8.1.
Due to https://github.com/jonasbb/serde_with/blob/master/serde_with_macros/src/lib.rs#L814, a
#[serde_as(deserialize_as = …)]
will generate#[schemars(deserialize_with(…))]
if featureschemars_0_8
is enabled, but https://github.com/GREsau/schemars/blob/master/schemars_derive/src/attr/schemars_to_serde.rs#L8-L31 does not containdeserialize_with
, onlyserialize_with
. Generation of#[schemars(deserialize_with(…))]
thus results in an compiler error. I suggest to use#[schemars(schema_with = "…")]
.The error I get looks like this: