dlt.common.validation
validate_dict
def validate_dict(spec: Type[_TypedDict],
doc: StrAny,
path: str,
filter_f: TFilterFunc = None,
validator_f: TCustomValidator = None) -> None
Validate the doc dictionary based on the given typed dictionary specification spec.
Arguments:
spec_Type[TypedDict] - The typed dictionary thatdocshould conform to.docStrAny - The dictionary to validate.pathstr - The string representing the location of the dictionary in a hierarchical data structure.filter_fTFilterFunc, optional - A function to filter keys indoc. It should returnTruefor keys to be kept. Defaults to a function that keeps all keys.validator_fTCustomValidator, optional - A function to perform additional validation for types not covered by this function. It should returnTrueif the validation passes or raise DictValidationException on validation error. For types it cannot validate, it should return False to allow chaining. Defaults to a function that rejects all such types.
Raises:
DictValidationException- If there are missing required fields, unexpected fields, type mismatches or unvalidated types indoccompared tospec.
Returns:
None