JSON Schema¶
Types¶
- exception jsonlogic.json_schema.types.UnsupportedOperation¶
- jsonlogic.json_schema.types.unpack_union(func: Callable[[JSONSchemaTypeT, TypeAliasForwardRef('JSONSchemaPrimitiveType'), TypeAliasForwardRef('BinaryOp')], JSONSchemaType], /) Callable[[JSONSchemaTypeT, JSONSchemaType, TypeAliasForwardRef('BinaryOp')], JSONSchemaType]¶
A utility decorator to unpack types of
UnionTypewhen callingJSONSchemaType.binary_op().If
otheris aUnionType, each type of the union will be recursively applied to thebinary_op()method.
- class jsonlogic.json_schema.types.JSONSchemaType¶
-
- abstractmethod binary_op(other: JSONSchemaType, op: BinaryOp, /) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- abstractmethod unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.UnionType(type: JSONSchemaTypeT, /)¶
- class jsonlogic.json_schema.types.UnionType(type: JSONSchemaPrimitiveTypeT, *types: JSONSchemaPrimitiveTypeT)
- class jsonlogic.json_schema.types.UnionType(type: JSONSchemaType, *types: JSONSchemaType)
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.ArrayType(elements_type: 'JSONSchemaTypeT')¶
- elements_type: JSONSchemaTypeT¶
The type of the elements of the array.
- binary_op(other: JSONSchemaType, op: BinaryOp) NoReturn¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.TupleType(tuple_types: 'tuple[Unpack[TupleTs]]')¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) NoReturn¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.AnyType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.BooleanType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) NoReturn¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.NumberType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.IntegerType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.StringType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) NoReturn¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.DatetimeType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) NoReturn¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.DateType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) NoReturn¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.DurationType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) JSONSchemaType¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.
- class jsonlogic.json_schema.types.NullType¶
-
- binary_op(other: JSONSchemaType, op: BinaryOp) NoReturn¶
Get the resulting type of the binary operation with the other provided type.
- Parameters:
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the operands
- unary_op(op: UnaryOp) JSONSchemaType¶
Get the resulting type of the unary operation.
- Parameters:
op¶ – The string representation of the operator.
- Returns:
The return type of the operation.
- Raises:
UnsupportedOperation – The operator is unsupported for the current type.