model_validate#
- classmethod Rules.model_validate(obj: Any, *, strict: bool | None = None, extra: Literal['allow', 'ignore', 'forbid'] | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self#
Validate a pydantic model instance.
- Args:
obj: The object to validate. strict: Whether to enforce types strictly. extra: Whether to ignore, allow, or forbid extra data during model validation.
See the [extra configuration value][pydantic.ConfigDict.extra] for details.
from_attributes: Whether to extract data from object attributes. context: Additional context to pass to the validator. by_alias: Whether to use the field’s alias when validating against the provided input data. by_name: Whether to use the field’s name when validating against the provided input data.
- Raises:
ValidationError: If the object could not be validated.
- Returns:
The validated model instance.