Update docs and changelog

This commit is contained in:
Graham Esau 2020-05-17 17:15:40 +01:00
parent e259955809
commit f9b14f7b00
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Changelog # Changelog
## In-dev - version TBC
### Added:
- `#[schemars(example = "...")]` attribute for setting examples on generated schemas (https://github.com/GREsau/schemars/issues/23)
## [0.7.5] - 2020-05-17 ## [0.7.5] - 2020-05-17
### 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`

View file

@ -32,6 +32,7 @@ Serde also allows setting `#[serde(...)]` attributes which change how types are
1. [Other Attributes](#other-attributes) 1. [Other Attributes](#other-attributes)
- [`schema_with`](#schema_with) - [`schema_with`](#schema_with)
- [`title` / `description`](#title-description) - [`title` / `description`](#title-description)
- [`example`](#example)
- [`deprecated`](#deprecated) - [`deprecated`](#deprecated)
- [Doc Comments (`doc`)](#doc) - [Doc Comments (`doc`)](#doc)
@ -157,11 +158,18 @@ Set on a variant or field to generate this field's schema using the given functi
<h3 id="title-description"> <h3 id="title-description">
`#[schemars(title = "Some title", description = "Some description)]` `#[schemars(title = "Some title", description = "Some description")]`
</h3> </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). 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="example">
`#[schemars(example = "some::function")]`
</h3>
Set on a container, variant or field to include the result of the given function in the generated schema's `examples`. The function should take no parameters and can return any type that implements serde's `Serialize` trait - it does not need to return the same type as the attached struct/field. This attribute can be repeated to specify multiple examples.
<h3 id="deprecated"> <h3 id="deprecated">
`#[deprecated]` `#[deprecated]`