Optional
alwaysSet default for always
option of decorators. Default can be overridden in decorator options.
Optional
disableOptional
dismissIf set to true, the validation will not use default messages. Error message always will be undefined if its not explicitly set.
Optional
enableIf set to true then class-validator will print extra warning messages to the console when something is not right.
Optional
forbidIf set to true, instead of stripping non-whitelisted properties validator will throw an error
Optional
forbidFails validation for objects unknown to class-validator. Defaults to true.
For instance, since a plain empty object has no annotations used for validation:
validate({})
// passesvalidate({}, { forbidUnknownValues: true })
// fails.validate(new SomeAnnotatedEmptyClass(), { forbidUnknownValues: true })
// passes.Optional
groupsGroups to be used during validation of the object.
Optional
skipIf set to true then validator will skip validation of all properties that are null or undefined in the validating object.
Optional
skipIf set to true then validator will skip validation of all properties that are null in the validating object.
Optional
skipIf set to true then validator will skip validation of all properties that are undefined in the validating object.
Optional
stopWhen set to true, validation of the given property will stop after encountering the first error. Defaults to false.
Optional
strictIf [groups]ValidatorOptions#groups is not given or is empty, ignore decorators with at least one group.
Optional
validationValidationError special options.
Optional
target?: booleanIndicates if target should be exposed in ValidationError.
Optional
value?: booleanIndicates if validated value should be exposed in ValidationError.
Optional
whitelistIf set to true validator will strip validated object of any properties that do not have any decorators.
Tip: if no other decorator is suitable for your property use
Options to be passed to
.validateModel
method. ExtendsValidatorOptions
from class-validator with additionaldisable
option to skip validation.