Skip to content

Commit

Permalink
Add example for optional dependency in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed Nov 25, 2021
1 parent 1a13ba9 commit 3cac0e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
```
7 changes: 7 additions & 0 deletions schemars/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3cac0e5

Please sign in to comment.