From cc28738f414619a2cae8b3ddd999c7f7d2a98992 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Sun, 17 Sep 2023 14:05:21 -0600 Subject: [PATCH] Support bigdecimal 0.4 (#237) --- schemars/Cargo.toml | 6 +++++- schemars/src/json_schema_impls/decimal.rs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index 88cbfd43..75fec92a 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -31,7 +31,8 @@ arrayvec07 = { version = "0.7", default-features = false, optional = true, packa url = { version = "2.0", default-features = false, optional = true } bytes = { version = "1.0", optional = true } rust_decimal = { version = "1", default-features = false, optional = true } -bigdecimal = { version = "0.3", default-features = false, optional = true } +bigdecimal03 = { version = "0.3", default-features = false, optional = true, package = "bigdecimal" } +bigdecimal04 = { version = "0.4", default-features = false, optional = true, package = "bigdecimal" } enumset = { version = "1.0", optional = true } smol_str = { version = "0.1.17", optional = true } semver = { version = "1.0.9", features = ["serde"], optional = true } @@ -61,6 +62,9 @@ arrayvec = ["arrayvec05"] indexmap1 = ["indexmap"] raw_value = ["serde_json/raw_value"] +# `bigdecimal` feature without version suffix is included only for back-compat - will be removed in a later version +bigdecimal = ["bigdecimal03"] +bigdecimal04 = ["dep:bigdecimal04"] ui_test = [] diff --git a/schemars/src/json_schema_impls/decimal.rs b/schemars/src/json_schema_impls/decimal.rs index b4c5f92d..cd959add 100644 --- a/schemars/src/json_schema_impls/decimal.rs +++ b/schemars/src/json_schema_impls/decimal.rs @@ -34,4 +34,6 @@ macro_rules! decimal_impl { #[cfg(feature = "rust_decimal")] decimal_impl!(rust_decimal::Decimal); #[cfg(feature = "bigdecimal")] -decimal_impl!(bigdecimal::BigDecimal); +decimal_impl!(bigdecimal03::BigDecimal); +#[cfg(feature = "bigdecimal04")] +decimal_impl!(bigdecimal04::BigDecimal);