Skip to main content

root_validator

No overview available.

def root_validator(
pre: Literal[True],
allow_reuse: bool = ...
) - > Callable

Decorates a function to perform validation on the entire data dictionary before or after individual field validation.

Parameters

NameTypeDescription
preLiteral[True]When set to True, indicates the validator should run before any field-level validation or type coercion occurs.
allow_reusebool = ...Whether to allow multiple models to share the same validator function without raising an error.

Returns

TypeDescription
CallableA decorator that wraps the provided validation function and registers it within the Pydantic model's validation pipeline.