Data Structures#
- class oblate.fields.Dict(key_tp=..., value_tp=..., /, **kwargs)#
A field that accepts a dictionary.
When initialized without an argument, the field accepts any arbitrary dictionary. The two positional arguments correspond to the type of key of dictionary and type of value respectively.
These arguments can take a type expression. For example,
Dict(Union[str, int], bool)accepts a dictionary with key of type either a string or integer and a boolean as a value.For more information type validation, see the Type Validation page.
New in version 1.1.
- ERR_INVALID_DATATYPE#
Error raised when the given value is not a dictionary.
- ERR_TYPE_VALIDATION_FAILED#
Error raised when the type validation fails. In this error’s context,
ErrorContext.metadatahas a keytype_validation_fail_errorswhich is a list of error messages.
- Parameters:
key_tp – The type of key of dictionary.
value_tp – The type of value of dictionary.
- class oblate.fields.TypedDict(typed_dict, /, **kwargs)#
A field that validates from a
typing.TypedDict.This class provides type validation on the values of given
TypedDict, For more information type validation, see the Type Validation page.New in version 1.1.
- ERR_INVALID_DATATYPE#
Error raised when the given value is not a dictionary.
- ERR_TYPE_VALIDATION_FAILED#
Error raised when the type validation fails. In this error’s context,
ErrorContext.metadatahas a keytype_validation_fail_errorswhich is a list of error messages.
- Parameters:
typed_dict (
typing.TypedDict) – The typed dictionary to validate from.
- class oblate.fields.List(type=..., /, **kwargs)#
A field that accepts a
list.New in version 1.1.
- ERR_INVALID_DATATYPE#
Error raised when the given value is not a dictionary.
- ERR_TYPE_VALIDATION_FAILED#
Error raised when the type validation fails. In this error’s context,
ErrorContext.metadatahas a keytype_validation_fail_errorswhich is a list of error messages.
- Parameters:
type – The type of list elements. This parameter corresponds to
Tintyping.List[T].
- class oblate.fields.Set(type=..., /, **kwargs)#
A field that accepts a
set.New in version 1.1.
- ERR_INVALID_DATATYPE#
Error raised when the given value is not a dictionary.
- ERR_TYPE_VALIDATION_FAILED#
Error raised when the type validation fails. In this error’s context,
ErrorContext.metadatahas a keytype_validation_fail_errorswhich is a list of error messages.
- Parameters:
type – The type of set elements. This parameter corresponds to
Tintyping.Set[T].