Typings#
- class oblate.fields.Any(*, none=False, required=True, frozen=False, default=..., validators=..., extras=..., dump_key=..., load_key=..., data_key=...)#
A field that accepts any arbitrary value.
This field acts as a “raw field” that performs no validation on the given value.
- class oblate.fields.Literal(*values, **kwargs)#
A field that accepts only exact literal values.
This works in a similar fashion as
typing.Literal.New in version 1.1.
- ERR_INVALID_VALUE#
Error raised when the given value is not from the provided literal value.
- Parameters:
*values – The literal values.
- class oblate.fields.Union(*types, **kwargs)#
A field that accepts values of any of the given data types.
This is similar to the
typing.Uniontype. Note that this field only performs simpleisinstance()check on the given value.New in version 1.1.
- ERR_INVALID_VALUE#
Error raised when the given value is not from the provided types.
- Parameters:
*types (
type) – The list of types to accept.
- class oblate.fields.TypeExpr(expr, **kwargs)#
A field that accepts value compatible with given type expression.
For the list of supported types and limitations of this field, please see the Type Validation section.
Note
This uses
oblate.validate_types()under the hood.New in version 1.1.
- Parameters:
expr – The type expression that should be used to validate the type of given value.