Skip to content

Commit 86183ac

Browse files
lwjohnst86signekb
andauthored
docs: 📝 simplify the guide on the Issues (#168)
# Description Just some small fixes and edits to the Issue guide. Needs a quick review. ## Checklist - [x] Formatted Markdown - [x] Ran `just run-all` --------- Co-authored-by: Signe Kirk Brødbæk <signebroedbaek@gmail.com>
1 parent bc647b8 commit 86183ac

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

docs/guide/issues.qmd

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ order: 2
77
## The `Issue` class
88

99
One `Issue` corresponds to one failed check on one field in the
10-
properties. An `Issue` has three attributes:
10+
properties. An `Issue` has attributes that provide information about the
11+
failed check, which are described in more detail in the
12+
[`Issue`](/docs/reference/Issue.qmd) documentation.
1113

12-
- `type`: The type of the check that failed and caused the issue. This
13-
can be a type that exists in the Data Package standard (e.g.,
14-
`required` or `pattern`) or a custom type.
15-
- `jsonpath`: The [JSON path](https://en.wikipedia.org/wiki/JSONPath)
16-
of the field that failed the check. For example,
17-
`$.resources[2].name`.
18-
- `message`: An explanation of what went wrong.
14+
<!-- TODO: Unhide this after it has been implemented. -->
1915

16+
::: content-hidden
2017
## The `explain()` function
2118

2219
The `explain()` function provides a more verbose and user-friendly
23-
description of a list of `Issue`s. To use it, pass it the issues output
24-
by `check()`:
20+
description of a list of `Issue`s. If you have package properties that
21+
looks like the below, with the missing `resources` field (that we remove
22+
here to demonstrate the `explain()` function):
2523

2624
```{python}
2725
import check_datapackage as cdp
26+
package_properties = cdp.example_package_properties()
27+
del package_properties["resources"]
28+
package_properties
29+
```
2830

29-
package_properties = {
30-
"name": 123,
31-
"title": "Hibernation Physiology of the Woolly Dormouse: A Scoping Review.",
32-
"id": "123-abc-123",
33-
"created": "2014-05-14T05:00:01+00:00",
34-
"version": "1.0.0",
35-
"licenses": [{"name": "odc-pddl"}],
36-
}
31+
You can give the issues found by `check()` to `explain()` to get a more
32+
human-friendly version of the problems:
3733

38-
cdp.check(properties=package_properties)
34+
```{python}
35+
#| eval: false
36+
issues = cdp.check(properties=package_properties)
37+
cdp.explain(issues)
3938
```
4039

4140
When setting `error=True` in `check()`, error messages will be generated
4241
by the `explain()` function.
42+
:::

0 commit comments

Comments
 (0)