aas_core3_2.jsonvalueverification

Verify that a value is JSON-able.

A JSON-able value is, recursively, exactly as JSON itself is defined: a None (JSON null), a boolean, a finite number, a string, an array of JSON-able values or an object of JSON-able values with string keys. Python offers no type which says exactly that, so a value has to be walked to make sure of it.

This module depends on no class of the meta-model. It is invoked from the ordinary per-class dispatch of aas_core3_2.verification, exactly as every other kind of property is – save for the keys of a JSONObject with a constrained primitive as its key, which the verification checks itself, by reusing the function it already generated for that constrained primitive.

aas_core3_2.jsonvalueverification.verify_json_value(value: Union[None, bool, int, float, str, Sequence[Any], Mapping[str, Any]]) → Iterator[Error][source]

Verify that value is a JSON-able value, at any depth.

The path of an error points into value itself: an item of an array contributes an index segment and a member of an object a key segment, so that the path leads all the way down to the culprit.

The value is walked depth first, so an error deep inside the first member is reported before an error on the second one. The errors thus come in the order in which a reader meets them going through the value.

Parameters

value – to be verified

Yield

errors, if any

aas_core3_2.jsonvalueverification.verify_json_array(value: Sequence[Any]) → Iterator[Error][source]

Verify that value is a JSON-able array.

Parameters

value – to be verified

Yield

errors, if any

aas_core3_2.jsonvalueverification.verify_json_object(value: Mapping[str, Any]) → Iterator[Error][source]

Verify that value is a JSON-able object.

Parameters

value – to be verified

Yield

errors, if any