aas_core3_2.reporting

Report where in the data an error lies.

A path is a sequence of segments which lead from the instance you handed over down to the erroneous value. It renders as a Python access expression, so that you can paste it as it stands:

.things[1].labels[0]

The vocabulary lives on its own so that aas_core3_2.verification, and the verification of a JSON-able value where the meta-model has one, report with the very same classes.

class aas_core3_2.reporting.PropertySegment(instance: Class, name: str)[source]

Represent a property access on a path to an erroneous value.

__init__(instance: Class, name: str) → None[source]

Initialize with the given values.

instance: Final[Class]

Instance containing the property

name: Final[str]

Name of the property

__str__() → str[source]

Return str(self).

class aas_core3_2.reporting.IndexSegment(sequence: Sequence[Any], index: int)[source]

Represent an index access on a path to an erroneous value.

__init__(sequence: Sequence[Any], index: int) → None[source]

Initialize with the given values.

sequence: Final[Sequence[Any]]

Sequence containing the item at index

index: Final[int]

Index of the item

__str__() → str[source]

Return str(self).

class aas_core3_2.reporting.KeySegment(mapping: Mapping[str, Any], key: str)[source]

Represent a member access on a path to an erroneous value.

Unlike a PropertySegment, which names a property of one of our classes, a key names a member of an open JSON-able object. It is known only at run time, and can be any string at all, so it is always rendered as a subscript.

__init__(mapping: Mapping[str, Any], key: str) → None[source]

Initialize with the given values.

mapping: Final[Mapping[str, Any]]

Mapping containing the value at key

key: Final[str]

Key of the value

__str__() → str[source]

Return str(self).

class aas_core3_2.reporting.Path[source]

Represent the relative path to the erroneous value.

__init__() → None[source]

Initialize as an empty path.

property segments: Sequence[Union[PropertySegment, IndexSegment, KeySegment]]

Get the segments of the path.

__str__() → str[source]

Return str(self).

class aas_core3_2.reporting.Error(cause: str)[source]

Represent a verification error in the data.

__init__(cause: str) → None[source]

Initialize as an error with an empty path.

cause: Final[str]

Human-readable description of the error

path: Final[Path]

Path to the erroneous value

__repr__() → str[source]

Return repr(self).