From 5b924aa67735b3c5ecebae80281f6a79a2ec1c2c Mon Sep 17 00:00:00 2001 From: Hudson Cooper Date: Mon, 11 Nov 2024 15:53:50 -0800 Subject: [PATCH] json_dumps --- parser/src/json/compiler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser/src/json/compiler.rs b/parser/src/json/compiler.rs index d3cd79d1..3e7dd35d 100644 --- a/parser/src/json/compiler.rs +++ b/parser/src/json/compiler.rs @@ -20,7 +20,7 @@ pub struct JsonCompileOptions { pub whitespace_flexible: bool, } -fn to_compact_json(target: &serde_json::Value) -> String { +fn json_dumps(target: &serde_json::Value) -> String { serde_json::to_string(target).unwrap() } @@ -385,7 +385,7 @@ impl Compiler { }, _ => { // let serde_json dump simple values - let const_str = to_compact_json(const_value); + let const_str = json_dumps(const_value); Ok(self.builder.string(&const_str)) } } @@ -575,7 +575,7 @@ impl Compiler { let property_schema = properties.get(name).unwrap_or(additional_properties); let is_required = required.contains(name); // Quote (and escape) the name. TODO: probably overkill to use json_dumps here - let quoted_name = to_compact_json(&json!(name)); + let quoted_name = json_dumps(&json!(name)); if property_schema == &Value::Bool(false) { if is_required { bail!("Required property has 'false' schema: {}", name);