Update docs and changelog

This commit is contained in:
Graham Esau 2020-05-17 11:45:36 +01:00
parent 75419fa3d5
commit 61c106fd5b
2 changed files with 12 additions and 2 deletions

View file

@ -2,7 +2,8 @@
## In-dev - version TBC ## In-dev - version TBC
### Added: ### Added:
- Setting `#[deprecated]` attribute will now cause generated schemas to have the `deprecated` property set to `true` - Setting `#[deprecated]` attribute will now cause generated schemas to have the `deprecated` property set to `true`
- Respect #[serde(transparent)] attribute (https://github.com/GREsau/schemars/issues/17) - Respect `#[serde(transparent)]` attribute (https://github.com/GREsau/schemars/issues/17)
- `#[schemars(title = "...", description = "...")]` can now be used to set schema title/description. If present, these values will be used instead of doc comments (https://github.com/GREsau/schemars/issues/13)
### Changed: ### Changed:
- schemars_derive is now an optional dependency, but included by default - schemars_derive is now an optional dependency, but included by default

View file

@ -31,6 +31,8 @@ Serde also allows setting `#[serde(...)]` attributes which change how types are
- [`with`](#with) - [`with`](#with)
1. [Other Attributes](#other-attributes) 1. [Other Attributes](#other-attributes)
- [`schema_with`](#schema_with) - [`schema_with`](#schema_with)
- [`title` / `description`](#title-description)
- [`deprecated`](#deprecated)
- [Doc Comments (`doc`)](#doc) - [Doc Comments (`doc`)](#doc)
## Supported Serde Attributes ## Supported Serde Attributes
@ -153,12 +155,19 @@ Serde docs: [container](https://serde.rs/container-attrs.html#transparent)
Set on a variant or field to generate this field's schema using the given function. This function must be callable as `fn(&mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema`. Set on a variant or field to generate this field's schema using the given function. This function must be callable as `fn(&mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema`.
<h3 id="title-description">
`#[schemars(title = "Some title", description = "Some description)]`
</h3>
Set on a container, variant or field to set the generated schema's `title` and/or `description`. If present, these will be used instead of values from any [`doc` comments/attributes](#doc).
<h3 id="deprecated"> <h3 id="deprecated">
`#[deprecated]` `#[deprecated]`
</h3> </h3>
Set the Rust build-in [`deprecated`](https://doc.rust-lang.org/edition-guide/rust-2018/the-compiler/an-attribute-for-deprecation.html) attribute on a struct, enum, field or variant to set the generated schema's `deprecated` keyword to `true`. Set the Rust built-in [`deprecated`](https://doc.rust-lang.org/edition-guide/rust-2018/the-compiler/an-attribute-for-deprecation.html) attribute on a struct, enum, field or variant to set the generated schema's `deprecated` keyword to `true`.
<h3 id="doc"> <h3 id="doc">