Coverage for src / check_datapackage / issue.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-09 12:26 +0000

1from dataclasses import dataclass, field 

2from typing import Any 

3 

4 

5@dataclass(order=True, frozen=True) 

6class Issue: 

7 """An issue found while checking a Data Package's properties. 

8 

9 One `Issue` object represents one failed check on one field within the properties. 

10 

11 Attributes: 

12 jsonpath (string): A [JSON path](https://jg-rp.github.io/python-jsonpath/syntax/) 

13 format pointing to the field in the input object where the issue is located. 

14 For example, `$.resources[2].name`. 

15 type (string): The type of the check that failed (e.g., a JSON schema type such 

16 as "required", "type", "pattern", or "format", or a custom type). Used to 

17 exclude specific types of issues. 

18 message (string): A description of what exactly the issue is. 

19 instance (Any): The part of the object that failed the check. This field is not 

20 considered when comparing or hashing `Issue` objects. 

21 

22 Examples: 

23 ```{python} 

24 import check_datapackage as cdp 

25 

26 issue = cdp.Issue( 

27 jsonpath="$.resources[2].title", 

28 type="required", 

29 message="The `title` field is required but missing at the given JSON path.", 

30 ) 

31 ``` 

32 """ 

33 

34 jsonpath: str 

35 type: str 

36 message: str 

37 instance: Any = field(default=None, compare=False, hash=False)