schemars
schemars copied to clipboard
Support for the `bounds` serde attribute.
It is sometimes necessary to have either phantom types or special bounds for types for the structs. serde
supports supplying custom bounds on these types so that the derived instance has useful bounds, instead of requiring all type parameters to have the Serialize/Deserialize
bounds.
It does not appear that schemars
honors these.
Concretely, I would like this to work
#[derive(Serialize, Deserialize)]
#[derive(JsonSchema)]
#[serde(bound = "A: Sized")]
struct S<A> {
x: u64,
#[serde(skip)]
a: PhantomData<A>
}
struct Dummy;
fn f() {
let schema = schema_for!(S<Dummy>);
}