The explanation of the issue is outputted as a string. To display the string in a easily readable format, the pretty_print() function from check-datapackage can be used.
Parameters
issues:list[Issue]
A list of Issue objects to explain.
Returns
str
A human-readable explanation of the issues.
Examples
import check_datapackage as cdpissue = cdp.Issue( jsonpath="$.resources[2].title",type="required", message="The `title` field is required but missing at the given JSON path.",)issues = cdp.explain([issue])# On its ownissues# Normal printprint(issues)# Pretty print with richcdp.pretty_print(issues)
'1 issue was found in your [u]datapackage.json[/u]:\n\nAt resources[2].title:\n|\n| title: None\n| [red]^^^^[/red]\nThe `title` field is required but missing at the given JSON path.\n'
1 issue was found in your [u]datapackage.json[/u]:
At resources[2].title:
|
| title: None
| [red]^^^^[/red]
The `title` field is required but missing at the given JSON path.
1 issue was found in your datapackage.json:
At resources[2].title:
|
| title: None
| ^^^^
The `title` field is required but missing at the given JSON path.