Skip to content

Commit

Permalink
only call notice! when instance_path is non empty
Browse files Browse the repository at this point in the history
  • Loading branch information
imor committed Jul 6, 2023
1 parent c12667c commit 036f973
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ fn jsonschema_is_valid(schema: Json) -> bool {
match jsonschema::JSONSchema::compile(&schema.0) {
Ok(_) => true,
Err(e) => {
notice!(
"Invalid JSON schema at path: {}",
e.instance_path.to_string()
);
// Only call notice! for a non empty instance_path
if e.instance_path.last().is_some() {
notice!(
"Invalid JSON schema at path: {}",
e.instance_path.to_string()
);
}
false
}
}
Expand Down

0 comments on commit 036f973

Please sign in to comment.