783 B
783 B
layout | title | parent | nav_order | summary |
---|---|---|---|---|
default | Using Serde Attributes | Examples | 2 | Deriving JsonSchema on types that use #[serde] attributes to customise serialization behaviour. |
Using Serde Attributes
One of the main aims of this library is compatibility with Serde. Any generated schema should match how serde_json would serialize/deserialize to/from JSON. To support this, Schemars will check for any #[serde(...)]
attributes on types that derive JsonSchema
, and adjust the generated schema accordingly.
The list of supported #[serde]
attributes are [documented here]({{ site.baseurl }}/deriving/attributes/#supported-serde-attributes).
{% include example.md name="serde_attrs" %}