Exclusion

Exclusion(jsonpath: Optional[str] = None, type: Optional[str] = None)

A check to be excluded when checking properties.

When you use both jsonpath and type in the same Exclusion object, only issues that match both will be excluded, meaning it is an AND logic. If you want OR logic, use multiple Exclusion objects in the Config.

Attributes

jsonpath : Optional[str]

JSON path to the field or fields in the input object where issues should be ignored. Uses JSON path syntax for queries, e.g., $.resources[0].name, to ignore issues related to that path.

type : Optional[str]

The type of check to exclude (e.g., a JSON schema type such as “required”, “type”, “pattern”, or “format”, or a custom type).

Examples

import check_datapackage as cdp

exclusion_required = cdp.Exclusion(type="required")
exclusion_name = cdp.Exclusion(jsonpath="$.name")
exclusion_desc_required = cdp.Exclusion(
    type="required",
    jsonpath="$.resources[*].description"
)
config = cdp.Config(
    exclusions=[
        exclusion_required,
        exclusion_name,
        exclusion_desc_required
    ]
)