Skip to content

Commit c38438e

Browse files
committed
dt-validate: Print the schema file causing the error
Since multiple schemas can be applied to a node, it's not always clear where the source of an error was. The jsonschema errors also don't have any way to get back to the schema file, but we have at least the starting schema file, so let's print it. If the schema file references other files, then those files could be the actual source. There's not currently a way to track $refs, so we only get the starting point. Signed-off-by: Rob Herring <[email protected]>
1 parent c31d2d8 commit c38438e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/dt-validate

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ class schema_group():
6464
'required property' in error.message:
6565
continue
6666

67-
print(dtschema.format_error(filename, error,
68-
nodename=nodename,
69-
verbose=verbose), file=sys.stderr)
67+
print(dtschema.format_error(filename, error, nodename=nodename, verbose=verbose) +
68+
'\n\tFrom schema: ' + schema['$filename'],
69+
file=sys.stderr)
7070
except RecursionError as e:
7171
print(ap.prog + ": recursion error: Check for prior errors in a referenced schema", file=sys.stderr)
7272

0 commit comments

Comments
 (0)