Skip to content

Commit

Permalink
Revert "Fix schemas for bigdecimal/rust_decimal (GREsau#248)"
Browse files Browse the repository at this point in the history
This reverts commit db1dd47.

# Conflicts:
#	schemars/Cargo.toml
#	schemars/tests/decimal.rs
#	schemars/tests/expected/bigdecimal03.json
  • Loading branch information
SohumB committed Jan 1, 2024
1 parent e04e3a3 commit aebf401
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 33 deletions.
4 changes: 0 additions & 4 deletions schemars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,5 @@ required-features = ["smol_str"]
name = "semver"
required-features = ["semver"]

[[test]]
name = "decimal"
required-features = ["rust_decimal", "bigdecimal03", "bigdecimal04"]

[package.metadata.docs.rs]
all-features = true
11 changes: 5 additions & 6 deletions schemars/src/json_schema_impls/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ use std::borrow::Cow;

macro_rules! decimal_impl {
($type:ty) => {
decimal_impl!($type => Number, "Number");
};
($type:ty => $instance_type:ident, $name:expr) => {
impl JsonSchema for $type {
no_ref_schema!();

fn schema_name() -> String {
"Decimal".to_owned()
$name.to_owned()
}

fn schema_id() -> Cow<'static, str> {
Expand All @@ -18,11 +21,7 @@ macro_rules! decimal_impl {

fn json_schema(_: &mut SchemaGenerator) -> Schema {
SchemaObject {
instance_type: Some(InstanceType::String.into()),
string: Some(Box::new(StringValidation {
pattern: Some(r"^-?[0-9]+(\.[0-9]+)?$".to_owned()),
..Default::default()
})),
instance_type: Some(InstanceType::$instance_type.into()),
..Default::default()
}
.into()
Expand Down
17 changes: 0 additions & 17 deletions schemars/tests/decimal.rs

This file was deleted.

6 changes: 0 additions & 6 deletions schemars/tests/expected/rust_decimal.json

This file was deleted.

0 comments on commit aebf401

Please sign in to comment.