Skip to content

Commit

Permalink
dt-validate: Print the schema file causing the error
Browse files Browse the repository at this point in the history
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 <robh@kernel.org>
  • Loading branch information
robherring committed Aug 19, 2020
1 parent c31d2d8 commit c38438e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/dt-validate
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c38438e

Please sign in to comment.