AbstractConstructs the first link in a schema chain.
Enforces T is in an invariant position. This prevents a validator with more strict rules is assigned to a less strict type, which can cause unexpected validation errors.
ReadonlyassertValidates the given input, asserting that the input is type T.
If the input is not valid, a ValidationError will be thrown.
The input to validate.
Optionalorigin: stringThe error origin. ErrorOrigin.API by default.
Optionalpath: readonly string[]The current field path to this validator.
Returns the input, cast as the validated type T
ReadonlyisReturns true if the input is valid according to this validator.
A short description of the validator.
ProtectedchainConstructs a new schema with a validator chaining the current validator with the provided next in an AND operation.
The validator to run after the current.
Returns a new Schema instance the same class with a new validator chaining the current validator with the given next in an AND operation.
ProtectedcloneClones this schema, transforming all validators with the given mutator.
ProtectedselfReadonlyvalidateThe input to validate.
Optionaloptions: ValidationOptionsValidation options.
Optionalpath: readonly string[]The current field path to this validator.
Returns an array of validation failures. If options.all is not true, only the
first error will be returned.
A base class for validation state. Provides methods for chaining.
Subclasses should not override constructors.