class-validator
Advanced tools
Changelog
0.14.0 (2022-12-09)
@IsTimeZone
decorator to check if given string is valid IANA time zone@IsISO4217CurrencyCode
decorator to check if the string is an ISO 4217 currency code@IsStrongPassword
decorator to check if given password matches specific complexity criteria@IsBase58
decorator to check if a string is base58 encoded@IsTaxId
decorator to check if a given string is a valid tax ID in a given locale@MinDate
and @MaxDate
decorators@IsEnum
decorator@types/validator
as dependency@NestedValidation
@IsDateString
decoratorSymbol
as parameter in error message generation@IsAlphanumeric
decoratorforbidUnknownValues
option by defaultlibphonenumber-js
to ^1.10.14
from ^1.9.43
forbidUnknownValues
option is enabled by default
From this release the forbidUnknownValues
is enabled by default. This is the desired behavior for majority of
use-cases, but this change may break validation for some. The two scenarios that results in failed validation:
The old behavior can be restored via specifying forbidUnknownValues: false
option when calling the validate functions.
For more details see PR #1798 and #1422 (comment).
@NestedValidation
decorator correctly assigns validation errors
Until now the errors from a nested validation in some cases were incorrectly assigned to the parent instead of the child being validated. Now the validation errors are correctly assigned.
For more details see #679.
Changelog
0.13.2 (2021-11-20)
NOTE: This version fixes a security vulnerability allowing denial of service attacks with a specially crafted request payload. Please update as soon as possible.
Array.isArray
in array checks from instanceof
operatorlibphonenumber-js
package updated to 1.9.43
from 1.9.7
validator
package updated to 13.5.2
from 13.5.2
Changelog
0.13.1 (2021-01-14)
ArrayUnique
decoratorIsUUID
decoratorValidationError.toString()
doesn't result in an error when forbidNonWhitelisted
parameter was usedIsIn
decorator@types/validator
package is correctly installedinlineSources
option is enabled in tsconfig preventing various sourcemap errors when consuming the packageChangelog
0.13.0 (2021-01-11)
always
- allows setting global default for always
option for decoratorsstrictGroups
- ignore decorators with at least one group, when ValidatorOptions.groups
is emptyisPostalCode
decorator (#634)IsDateString()
decorator now aliases the IsISO8601()
decorator (#672)Changelog
0.12.0 (2020-04-18)
constraints
property in ValidationError (#465) (84680ad), closes #309Validatorjs releases contain some breaking changes e.g. IsMobileNumber
or IsHexColor
. Please check validatorjs CHANGELOG
Validation functions was removed from Validator
class to enable tree shaking.
BEFORE:
import { Validator } from 'class-validator';
const validator = new Validator();
validator.isNotIn(value, possibleValues);
validator.isBoolean(value);
AFTER:
import { isNotIn, isBoolean } from 'class-validator';
isNotIn(value, possibleValues);
isBoolean(value);
IsNumberString decorator arguments changed to @IsNumberString(ValidatorJS.IsNumericOptions, ValidationOptions)
.