Skip to content

Commit a8d7233

Browse files
committed
Cleanup and test updates for bigdecimal04
1 parent cc28738 commit a8d7233

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

schemars/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ indexmap1 = ["indexmap"]
6464
raw_value = ["serde_json/raw_value"]
6565
# `bigdecimal` feature without version suffix is included only for back-compat - will be removed in a later version
6666
bigdecimal = ["bigdecimal03"]
67-
bigdecimal04 = ["dep:bigdecimal04"]
6867

6968
ui_test = []
7069

@@ -126,7 +125,7 @@ required-features = ["semver"]
126125

127126
[[test]]
128127
name = "decimal"
129-
required-features = ["rust_decimal", "bigdecimal"]
128+
required-features = ["rust_decimal", "bigdecimal03", "bigdecimal04"]
130129

131130
[package.metadata.docs.rs]
132131
all-features = true

schemars/src/json_schema_impls/decimal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ macro_rules! decimal_impl {
3333

3434
#[cfg(feature = "rust_decimal")]
3535
decimal_impl!(rust_decimal::Decimal);
36-
#[cfg(feature = "bigdecimal")]
36+
#[cfg(feature = "bigdecimal03")]
3737
decimal_impl!(bigdecimal03::BigDecimal);
3838
#[cfg(feature = "bigdecimal04")]
3939
decimal_impl!(bigdecimal04::BigDecimal);

schemars/src/json_schema_impls/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ mod bytes;
5151
#[cfg(feature = "chrono")]
5252
mod chrono;
5353
mod core;
54-
#[cfg(any(feature = "rust_decimal", feature = "bigdecimal"))]
54+
#[cfg(any(
55+
feature = "rust_decimal",
56+
feature = "bigdecimal03",
57+
feature = "bigdecimal04"
58+
))]
5559
mod decimal;
5660
#[cfg(feature = "either")]
5761
mod either;

schemars/tests/decimal.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ fn rust_decimal() -> TestResult {
77
}
88

99
#[test]
10-
fn bigdecimal() -> TestResult {
11-
test_default_generated_schema::<bigdecimal::BigDecimal>("bigdecimal")
10+
fn bigdecimal03() -> TestResult {
11+
test_default_generated_schema::<bigdecimal03::BigDecimal>("bigdecimal03")
12+
}
13+
14+
#[test]
15+
fn bigdecimal04() -> TestResult {
16+
test_default_generated_schema::<bigdecimal04::BigDecimal>("bigdecimal04")
1217
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Decimal",
4+
"type": "string",
5+
"pattern": "^-?[0-9]+(\\.[0-9]+)?$"
6+
}

0 commit comments

Comments
 (0)