OptionalalwaysSet default for always option of decorators. Default can be overridden in decorator options.
OptionaldisableOptionaldismissIf set to true, the validation will not use default messages. Error message always will be undefined if its not explicitly set.
OptionalenableIf set to true then class-validator will print extra warning messages to the console when something is not right.
OptionalforbidIf set to true, instead of stripping non-whitelisted properties validator will throw an error
OptionalforbidFails 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.OptionalgroupsGroups to be used during validation of the object.
OptionalskipIf set to true then validator will skip validation of all properties that are null or undefined in the validating object.
OptionalskipIf set to true then validator will skip validation of all properties that are null in the validating object.
OptionalskipIf set to true then validator will skip validation of all properties that are undefined in the validating object.
OptionalstopWhen set to true, validation of the given property will stop after encountering the first error. Defaults to false.
OptionalstrictIf [groups]ValidatorOptions#groups is not given or is empty, ignore decorators with at least one group.
OptionalvalidationValidationError special options.
Optionaltarget?: booleanIndicates if target should be exposed in ValidationError.
Optionalvalue?: booleanIndicates if validated value should be exposed in ValidationError.
OptionalwhitelistIf 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
.validateModelmethod. ExtendsValidatorOptionsfrom class-validator with additionaldisableoption to skip validation.