Document schema_with
attribute
This commit is contained in:
parent
3fd316063a
commit
4c501990b1
6 changed files with 39 additions and 9 deletions
|
@ -13,7 +13,7 @@ summary: >-
|
|||
|
||||
Serde allows you to change how a field is (de)serialized by setting a [`#[serde(with = "path")]`](https://serde.rs/field-attrs.html#with) attribute, where `$path::serialize` and `$path::deserialize` must be functions with the correct signature. Schemars supports the same attribute, but `path` must be a type implementing `JsonSchema`.
|
||||
|
||||
In order to derive `JsonSchema` on a type which includes a `#[serde(with = "path")]` attribute where `path` is not a type implementing `JsonSchema`, you'll need to override it with a suitable `#[schemars(with = "Type")]` attribute.
|
||||
In order to derive `JsonSchema` on a type which includes a `#[serde(with = "path")]` attribute where `path` is not a type implementing `JsonSchema`, you'll need to override it with a suitable `#[schemars(with = "Type")]` or `#[schemars(schema_with = "path")]` attribute.
|
||||
|
||||
{% include example.md name="custom_serialization" %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue