From 38a67a132da48d1debfba73da0fda2b5da8e1e90 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Mon, 9 Sep 2024 20:05:46 +0100 Subject: [PATCH] Remove enumset optional dependency The `JsonSchema` impl for enumset does not accurately represent how it is de/serialized by default --- Cargo.lock | 68 --------------------------- README.md | 1 - docs/0-migrating.md | 3 +- docs/4-features.md | 1 - schemars/Cargo.toml | 5 -- schemars/src/json_schema_impls/mod.rs | 3 -- schemars/tests/enumset.rs | 18 ------- 7 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 schemars/tests/enumset.rs diff --git a/Cargo.lock b/Cargo.lock index 665db12b..40a1e2ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,40 +51,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "diff" version = "0.1.13" @@ -103,39 +69,12 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "enumset" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "form_urlencoded" version = "1.2.0" @@ -157,12 +96,6 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.4.0" @@ -317,7 +250,6 @@ dependencies = [ "chrono", "dyn-clone", "either", - "enumset", "indexmap", "pretty_assertions", "ref-cast", diff --git a/README.md b/README.md index be8bfc96..d26db122 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,6 @@ Schemars can implement `JsonSchema` on types from several popular crates, enable - `bytes1` - [bytes](https://crates.io/crates/bytes) (^1.0) - `chrono04` - [chrono](https://crates.io/crates/chrono) (^0.4) - `either1` - [either](https://crates.io/crates/either) (^1.3) -- `enumset1` - [enumset](https://crates.io/crates/enumset) (^1.0) - `indexmap2` - [indexmap](https://crates.io/crates/indexmap) (^2.0) - `rust_decimal1` - [rust_decimal](https://crates.io/crates/rust_decimal) (^1.0) - `semver1` - [semver](https://crates.io/crates/semver) (^1.0.9) diff --git a/docs/0-migrating.md b/docs/0-migrating.md index 80fccb38..be79b360 100644 --- a/docs/0-migrating.md +++ b/docs/0-migrating.md @@ -23,10 +23,9 @@ All optional dependencies are now suffixed by their version: - `url` is now `url2` - `bytes` is now `bytes1` - `rust_decimal` is now `rust_decimal1` -- `enumset` is now `enumset1` - `smol_str` is now `smol_str02` - `semver` is now `semver1` -- `indexmap`, `uuid08`, `arrayvec05` and `bigdecimal03` have been removed +- `enumset`, `indexmap`, `uuid08`, `arrayvec05` and `bigdecimal03` have been removed - `indexmap2`, `arrayvec07` and `bigdecimal04` are unchanged ## `Schema` is now a wrapper around `serde_json::Value` diff --git a/docs/4-features.md b/docs/4-features.md index c2b80d18..b0b20460 100644 --- a/docs/4-features.md +++ b/docs/4-features.md @@ -18,7 +18,6 @@ Schemars can implement `JsonSchema` on types from several popular crates, enable - `bytes1` - [bytes](https://crates.io/crates/bytes) (^1.0) - `chrono04` - [chrono](https://crates.io/crates/chrono) (^0.4) - `either1` - [either](https://crates.io/crates/either) (^1.3) -- `enumset1` - [enumset](https://crates.io/crates/enumset) (^1.0) - `indexmap2` - [indexmap](https://crates.io/crates/indexmap) (^2.0) - `rust_decimal1` - [rust_decimal](https://crates.io/crates/rust_decimal) (^1.0) - `semver1` - [semver](https://crates.io/crates/semver) (^1.0.9) diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 7645939d..8139ae07 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -25,7 +25,6 @@ bigdecimal04 = { version = "0.4", default-features = false, optional = true, pac bytes1 = { version = "1.0", default-features = false, optional = true, package = "bytes" } chrono04 = { version = "0.4", default-features = false, optional = true, package = "chrono" } either1 = { version = "1.3", default-features = false, optional = true, package = "either" } -enumset1 = { version = "1.0", default-features = false, optional = true, package = "enumset" } indexmap2 = { version = "2.0", default-features = false, optional = true, package = "indexmap" } rust_decimal1 = { version = "1", default-features = false, optional = true, package = "rust_decimal"} semver1 = { version = "1.0.9", default-features = false, optional = true, package = "semver" } @@ -104,10 +103,6 @@ required-features = ["arrayvec07"] name = "url" required-features = ["url2"] -[[test]] -name = "enumset" -required-features = ["enumset1"] - [[test]] name = "smol_str" required-features = ["smol_str02"] diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs index 1921a6ae..0a8bcb37 100644 --- a/schemars/src/json_schema_impls/mod.rs +++ b/schemars/src/json_schema_impls/mod.rs @@ -75,9 +75,6 @@ mod decimal; #[cfg(feature = "either1")] mod either1; -#[cfg(feature = "enumset1")] -forward_impl!(( crate::JsonSchema for enumset1::EnumSet) => alloc::collections::BTreeSet); - #[cfg(feature = "indexmap2")] mod indexmap2; diff --git a/schemars/tests/enumset.rs b/schemars/tests/enumset.rs deleted file mode 100644 index c04ba0e1..00000000 --- a/schemars/tests/enumset.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod util; -use enumset1::{EnumSet, EnumSetType}; -use schemars::JsonSchema; -use util::*; - -// needed to derive EnumSetType when using a crate alias -extern crate enumset1 as enumset; - -#[derive(EnumSetType, JsonSchema)] -enum Foo { - Bar, - Baz, -} - -#[test] -fn enumset() -> TestResult { - test_default_generated_schema::>("enumset") -}