Fix schemas for bigdecimal/rust_decimal (#248)
Both of these crates serialise decimals as strings, not as plain numbers
This commit is contained in:
parent
a5e51b22b3
commit
db1dd47039
5 changed files with 34 additions and 5 deletions
12
schemars/tests/decimal.rs
Normal file
12
schemars/tests/decimal.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
mod util;
|
||||
use util::*;
|
||||
|
||||
#[test]
|
||||
fn rust_decimal() -> TestResult {
|
||||
test_default_generated_schema::<rust_decimal::Decimal>("rust_decimal")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bigdecimal() -> TestResult {
|
||||
test_default_generated_schema::<bigdecimal::BigDecimal>("bigdecimal")
|
||||
}
|
6
schemars/tests/expected/bigdecimal.json
Normal file
6
schemars/tests/expected/bigdecimal.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Decimal",
|
||||
"type": "string",
|
||||
"pattern": "^-?[0-9]+(\\.[0-9]+)?$"
|
||||
}
|
6
schemars/tests/expected/rust_decimal.json
Normal file
6
schemars/tests/expected/rust_decimal.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Decimal",
|
||||
"type": "string",
|
||||
"pattern": "^-?[0-9]+(\\.[0-9]+)?$"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue