diff --git a/parser/src/json/compiler.rs b/parser/src/json/compiler.rs index f505e15f..2a589cac 100644 --- a/parser/src/json/compiler.rs +++ b/parser/src/json/compiler.rs @@ -293,7 +293,11 @@ impl Compiler { })?; let mut ast = RegexAst::Regex(rx); if let Some(d) = num.multiple_of.as_ref() { - ast = RegexAst::And(vec![ast, RegexAst::MultipleOf(d.coef, d.exp)]); + let multiple_rx = RegexAst::Concat(vec![ + RegexAst::Regex("-?".to_string()), + RegexAst::MultipleOf(d.coef, d.exp), + ]); + ast = RegexAst::And(vec![ast, multiple_rx]); } Ok(ast) } @@ -314,7 +318,11 @@ impl Compiler { })?; let mut ast = RegexAst::Regex(rx); if let Some(d) = num.multiple_of.as_ref() { - ast = RegexAst::And(vec![ast, RegexAst::MultipleOf(d.coef, d.exp)]); + let multiple_rx = RegexAst::Concat(vec![ + RegexAst::Regex("-?".to_string()), + RegexAst::MultipleOf(d.coef, d.exp), + ]); + ast = RegexAst::And(vec![ast, multiple_rx]); } Ok(ast) } diff --git a/parser/src/json/schema.rs b/parser/src/json/schema.rs index 160db60c..c26b9cae 100644 --- a/parser/src/json/schema.rs +++ b/parser/src/json/schema.rs @@ -920,8 +920,10 @@ fn compile_numeric(schema: &HashMap<&str, &Value>, integer: bool) -> Result