Typing helpers¶
Module defining reusable type aliases throughout the library.
- jsonlogic.typing.JSONLogicPrimitive: TypeAlias = 'JSONPrimitive | list[JSONLogicPrimitive]'¶
A JSON Logic primitive is recursively defined either as a JSON primitive or a list of JSON Logic primitives.
Such primitives are only considered when dealing with operator arguments:
{ "op": [ "a string", // A valid primitive (in this case a JSON primitive) ["a list"], // A list of JSON primitives [1, [2, 3]] ] }
- jsonlogic.typing.OperatorArgument: TypeAlias = 'Operator | JSONLogicPrimitive | list[OperatorArgument]'¶
An operator argument is recursively defined either as a JSON Logic primitive, an operator or a list of operator arguments.
{ "op": [ {"nested_op": "..."}, // A nested operator [1, {"other_op": "..."}], ["a list"] // A JSON Logic primitive ] }