Add example for optional dependency in readme

Based on https://github.com/GREsau/schemars/pull/118/files
This commit is contained in:
Graham Esau 2021-11-25 21:12:30 +00:00
parent 1a13ba9f9b
commit 3cac0e5048
2 changed files with 14 additions and 0 deletions

View file

@ -275,3 +275,10 @@ Schemars can implement `JsonSchema` on types from several popular crates, enable
- [`url`](https://crates.io/crates/url) (^2.0)
- [`bytes`](https://crates.io/crates/bytes) (^1.0)
- [`enumset`](https://crates.io/crates/enumset) (^1.0)
For example, to implement `JsonSchema` on types from `chrono`, enable it as a feature in the `schemars` dependency in your `Cargo.toml` like so:
```toml
[dependencies]
schemars = { version = "0.8", features = ["chrono"] }
```

View file

@ -270,6 +270,13 @@ Schemars can implement `JsonSchema` on types from several popular crates, enable
- [`url`](https://crates.io/crates/url) (^2.0)
- [`bytes`](https://crates.io/crates/bytes) (^1.0)
- [`enumset`](https://crates.io/crates/enumset) (^1.0)
For example, to implement `JsonSchema` on types from `chrono`, enable it as a feature in the `schemars` dependency in your `Cargo.toml` like so:
```toml
[dependencies]
schemars = { version = "0.8", features = ["chrono"] }
```
*/
/// The map type used by schemars types.