Validate
Callable
Type parameters
- T
Parameters
validators: ValidationOptions<T> | ValidationOptions<T>[]
One constraint, or an array of them. Each constraint carries the
optionsto apply, and an optionaldestructto reduce the property into the list of values the constraints run against. Withoutdestruct, the property value is validated as-is.optionaltransform: (value: any) => any
Runs before validation, and replaces the stored value with what it returns.
Returns (target: any, propertyKey: string) => void
Parameters
target: any
propertyKey: string
Returns void
A
@Validateis a property decorator to validate a property. It is typically used in Schema to validate schema properties.Validation runs on assignment, and a failure throws a ValidationTransactionError. Declaring constraints here is what lets a module reject bad inputs before any infrastructure is touched.
Decorators
Techniques for Validation for the full list of constraints.