From 2a268bb5cd1b2e9d33c33a2adee0cb95cb49b787 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 30 Oct 2023 15:59:14 +0100 Subject: [PATCH] fixes --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index ea49721..c82abd0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,13 @@ pub fn get_frontmatter(markdown: &str) -> Option { fn require_everything(schema: &mut serde_json::Value) { if let Some(schema_obj) = schema.as_object_mut() { - if schema_obj.get("type").unwrap().as_str().unwrap() == "object" { + if match schema_obj.get("type").unwrap() { + serde_json::Value::String(str) => str == "object", + serde_json::Value::Array(lst) => { + lst.contains(&serde_json::Value::String("object".into())) + } + _ => false, + } { let keys: Vec<_> = schema_obj .get("properties") .unwrap() @@ -99,7 +105,11 @@ fn main() { //println!("{file}: {:#?}", error); - let file = Style::new().blue().apply_to(file); + let file = Style::new().blue().apply_to(if file.contains(' ') { + format!("\"{file}\"") + } else { + file.to_string() + }); let path = Style::new().bright().red().apply_to(path); match error.kind {