From ec0a01b82bd28fef3dd4c7a54babdeecbcbe86d3 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Sun, 29 Dec 2019 00:28:54 +0000 Subject: [PATCH] Update optional dependencies docs --- CHANGELOG.md | 4 ++++ README.md | 12 ++++++++---- docs/4-features.md | 27 ++++++++++----------------- schemars/Cargo.toml | 2 -- schemars/src/lib.rs | 10 +++++++++- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf3108..6553d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## next +### Added: +- Implemented `JsonSchema` on types from `smallvec` and `arrayvec` (as optional dependencies) + ## 0.6.4 - 2019-12-27 ### Added: - Implemented `JsonSchema` on types from `indexmap`, `either` and `uuid` (as optional dependencies) diff --git a/README.md b/README.md index b35304e..28d375c 100644 --- a/README.md +++ b/README.md @@ -207,9 +207,13 @@ fn main() { `#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde. ## Feature Flags -- `chrono` - implements `JsonSchema` for all [Chrono](https://github.com/chronotope/chrono) types which are serializable by Serde. -- `indexmap` - implements `JsonSchema` on `IndexMap` and `IndexSet` from [indexmap](https://github.com/bluss/indexmap). -- `either` - implements `JsonSchema` on [`Either`](https://github.com/bluss/either). -- `uuid` - implements `JsonSchema` on [`Uuid`](https://github.com/uuid-rs/uuid). - `impl_json_schema` - implements `JsonSchema` for Schemars types themselves +## Optional Dependencies +Schemars can implement `JsonSchema` on types from several popular crates, enabled via optional dependencies (dependency versions are shown in brackets): +- [`chrono`](https://crates.io/crates/chrono) (^0.4) +- [`indexmap`](https://crates.io/crates/indexmap) (^1.2) +- [`either`](https://crates.io/crates/either) (^1.3) +- [`uuid`](https://crates.io/crates/uuid) (^0.8) +- [`smallvec`](https://crates.io/crates/uuid) (^1.0) +- [`arrayvec`](https://crates.io/crates/arrayvec) (^0.5) diff --git a/docs/4-features.md b/docs/4-features.md index 8c2d601..04bb95a 100644 --- a/docs/4-features.md +++ b/docs/4-features.md @@ -13,21 +13,14 @@ Some functionality can be selectively enabled/disabled via [Cargo features](http schemars = { version = "0.6", features = ["chrono"] } ``` -
+## Feature Flags +- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves -### impl_json_schema -Implements `JsonSchema` on Schemars types themselves. - -### chrono -Implements `JsonSchema` on all [Chrono](https://github.com/chronotope/chrono) types which are serializable by Serde. - -### indexmap -Implements `JsonSchema` on `IndexMap` and `IndexSet` from [indexmap](https://github.com/bluss/indexmap). - -### either -Implements `JsonSchema` on [`Either`](https://github.com/bluss/either). - -### uuid -Implements `JsonSchema` on [`Uuid`](https://github.com/uuid-rs/uuid). - -
+## Optional Dependencies +Schemars can implement `JsonSchema` on types from several popular crates, enabled via optional dependencies (dependency versions are shown in brackets): +- [`chrono`](https://crates.io/crates/chrono) (^0.4) +- [`indexmap`](https://crates.io/crates/indexmap) (^1.2) +- [`either`](https://crates.io/crates/either) (^1.3) +- [`uuid`](https://crates.io/crates/uuid) (^0.8) +- [`smallvec`](https://crates.io/crates/uuid) (^1.0) +- [`arrayvec`](https://crates.io/crates/arrayvec) (^0.5) diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index facdf70..950ca8a 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -23,8 +23,6 @@ either = { version = "1.3", default-features = false, optional = true } uuid = { version = "0.8", default-features = false, optional = true } smallvec = { version = "1.0", optional = true } arrayvec = { version = "0.5", default-features = false, optional = true } -# TODO implement JsonSchema on bytes types. bytes 0.5 requires Rust 1.39+ -# bytes = { version = "0.5", default-features = false, optional = true } [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs index af08336..21c6b30 100644 --- a/schemars/src/lib.rs +++ b/schemars/src/lib.rs @@ -201,8 +201,16 @@ fn main() { `#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde. ## Feature Flags -- `chrono` - implements `JsonSchema` for all [Chrono](https://github.com/chronotope/chrono) types which are serializable by Serde. - `impl_json_schema` - implements `JsonSchema` for Schemars types themselves + +## Optional Dependencies +Schemars can implement `JsonSchema` on types from several popular crates, enabled via optional dependencies (dependency versions are shown in brackets): +- [`chrono`](https://crates.io/crates/chrono) (^0.4) +- [`indexmap`](https://crates.io/crates/indexmap) (^1.2) +- [`either`](https://crates.io/crates/either) (^1.3) +- [`uuid`](https://crates.io/crates/uuid) (^0.8) +- [`smallvec`](https://crates.io/crates/uuid) (^1.0) +- [`arrayvec`](https://crates.io/crates/arrayvec) (^0.5) */ /// The map type used by schemars types.