Cleanup and test updates for bigdecimal04

This commit is contained in:
Graham Esau 2023-09-17 21:10:22 +01:00
parent cc28738f41
commit a8d723342f
6 changed files with 20 additions and 6 deletions

View file

@ -64,7 +64,6 @@ 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 = []
@ -126,7 +125,7 @@ required-features = ["semver"]
[[test]]
name = "decimal"
required-features = ["rust_decimal", "bigdecimal"]
required-features = ["rust_decimal", "bigdecimal03", "bigdecimal04"]
[package.metadata.docs.rs]
all-features = true

View file

@ -33,7 +33,7 @@ macro_rules! decimal_impl {
#[cfg(feature = "rust_decimal")]
decimal_impl!(rust_decimal::Decimal);
#[cfg(feature = "bigdecimal")]
#[cfg(feature = "bigdecimal03")]
decimal_impl!(bigdecimal03::BigDecimal);
#[cfg(feature = "bigdecimal04")]
decimal_impl!(bigdecimal04::BigDecimal);

View file

@ -51,7 +51,11 @@ mod bytes;
#[cfg(feature = "chrono")]
mod chrono;
mod core;
#[cfg(any(feature = "rust_decimal", feature = "bigdecimal"))]
#[cfg(any(
feature = "rust_decimal",
feature = "bigdecimal03",
feature = "bigdecimal04"
))]
mod decimal;
#[cfg(feature = "either")]
mod either;

View file

@ -7,6 +7,11 @@ fn rust_decimal() -> TestResult {
}
#[test]
fn bigdecimal() -> TestResult {
test_default_generated_schema::<bigdecimal::BigDecimal>("bigdecimal")
fn bigdecimal03() -> TestResult {
test_default_generated_schema::<bigdecimal03::BigDecimal>("bigdecimal03")
}
#[test]
fn bigdecimal04() -> TestResult {
test_default_generated_schema::<bigdecimal04::BigDecimal>("bigdecimal04")
}

View file

@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Decimal",
"type": "string",
"pattern": "^-?[0-9]+(\\.[0-9]+)?$"
}