Skip to content

Commit

Permalink
json_dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-ai committed Nov 11, 2024
1 parent d576962 commit 5b924aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parser/src/json/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5b924aa

Please sign in to comment.