Skip to content
masterclass Buddy

Pydantic · Type Alias

BeforeValidator

BeforeValidator runs a function before Pydantic validates a value against its annotated type. Use it to normalize raw input, then return the value for normal validation.

Last updated

Syntax

BeforeValidator(func)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • AfterValidator
  • PlainValidator
  • WrapValidator
  • field_validator
  • Before validators

Source: Functional Validators | Pydantic Docs. Checked 2026-11-03.