From c38438eb08f56089ff10ef93aafcc9e932b69f39 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 19 Aug 2020 12:21:41 -0600 Subject: [PATCH] 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 --- tools/dt-validate | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/dt-validate b/tools/dt-validate index 16dc7fc8..c03efd38 100755 --- a/tools/dt-validate +++ b/tools/dt-validate @@ -64,9 +64,9 @@ class schema_group(): 'required property' in error.message: continue - print(dtschema.format_error(filename, error, - nodename=nodename, - verbose=verbose), file=sys.stderr) + print(dtschema.format_error(filename, error, nodename=nodename, verbose=verbose) + + '\n\tFrom schema: ' + schema['$filename'], + file=sys.stderr) except RecursionError as e: print(ap.prog + ": recursion error: Check for prior errors in a referenced schema", file=sys.stderr)