From 6a59823f6e4f2f5882f8d98ce77fc52c0483c33f Mon Sep 17 00:00:00 2001 From: Kevin Goslar Date: Tue, 16 Nov 2021 07:43:22 -0600 Subject: [PATCH] Add example for optional dependency in readme It took me a while to figure out how to enable optional dependencies. Fortunately, https://graham.cool/schemars/features provides an example. This pull request makes this example better discoverable by adding it to the main readme file. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f5cafb9a..1f81f6d0 100644 --- a/README.md +++ b/README.md @@ -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) + +As an example, to enable `JsonSchema` types for the `chrono` crate, load `schemars` like this in your `cargo.toml`: + +```toml +[dependencies] +schemars = { version = "0.8", features = ["chrono"] } +```