From 3cac0e5048e0afb37297b00ccc7223cd6c648983 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Thu, 25 Nov 2021 21:12:30 +0000 Subject: [PATCH] Add example for optional dependency in readme Based on https://github.com/GREsau/schemars/pull/118/files --- README.md | 7 +++++++ schemars/src/lib.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index f5cafb9a..c9e55f25 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) + +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"] } +``` diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs index d62f1d35..c0f6e1fa 100644 --- a/schemars/src/lib.rs +++ b/schemars/src/lib.rs @@ -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.