Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Latest commit

 

History

History
360 lines (226 loc) · 19.2 KB

CHANGELOG.md

File metadata and controls

360 lines (226 loc) · 19.2 KB

0.13.1 (2021-01-14)

Added

  • optional mather function has been added to the ArrayUnique decorator

Fixed

  • a typo was fixed in the error message generated by the IsUUID decorator
  • calling ValidationError.toString() doesn't result in an error when forbidNonWhitelisted parameter was used
  • fixed typo in error message generated by IsIn decorator
  • the @types/validator package is correctly installed
  • inlineSources option is enabled in tsconfig preventing various sourcemap errors when consuming the package

Changed

  • various dev dependencies has been updated

0.13.0 (2021-01-11)

Added

  • project is restructured to allow three-shaking
  • added option to fail on first validation error (#620)
  • two new validator option is added:
    • always - allows setting global default for always option for decorators
    • strictGroups - ignore decorators with at least one group, when ValidatorOptions.groups is empty

Fixed

  • the 'any' locale is allowed in the isPostalCode decorator (#634)
  • the IsDateString() decorator now aliases the IsISO8601() decorator (#672)

Changed

  • project tooling has been updated significantly
  • google-libphonenumber has been replaced with libphonenumber-js (this should have no effect on validation)
  • build process generates include both ES/CommonJS and UMD variations
  • various dev dependencies has been updated

0.12.2 (2020-04-23)

Bug Fixes

  • move tslib from peerDependencies to dependencies (827eff1), closes #588

0.12.1 (2020-04-18)

Bug Fixes

  • apply only nested validator for ValidateNested multi-dimensional array (c463be5)

0.12.0 (2020-04-18)

Bug Fixes

  • accept negative timezone in isDateString (#564) (2012d72), closes #565
  • apply all decorators type PropertyDecorator (#556) (5fb36e3), closes #555
  • avoiding metadataStorage from DI (#335) (b57fef4), closes #328 #261 #132
  • correct registerDecorator options argument (7909ec6), closes #302
  • IsNumberString accept isNumbericOptions as argument (62b993f), closes #518 #463
  • optional constraints property in ValidationError (#465) (84680ad), closes #309
  • pass context to ValidationError for async validations (#533) (4eb1216)
  • switch isLatitude & isLongitude validators (#513) (5497179), closes #502
  • switch isLatitude & isLongitude validators (#537) (c27500b)
  • ValidateNested support multi-dimensional arrays (#539) (62678e1)

Code Refactoring

Features

  • sync validatorjs version from v10.11.3 to v13.0.0 (09120b7), closes #576 #425

BREAKING CHANGES

  • Validatorjs 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).

0.11.1 (2020-03-18)

Bug Fixes

  • IsNumber validator now works when maxDecimalPlaces=0 (#524) (b8aa922)

Features

0.11.0 (2019-11-01)

Bug Fixes

  • create instance of ValidationError for whitelist errors (#434) (a98f5dd), closes #325
  • pass context for isDefined and custom validators (#296) (0ef898e), closes #292

Features

BREAKING CHANGES

  • update @types/validator from 11.1.0 to version 12.0.0 - please check it's changelog

0.10.2 (2019-10-14)

Bug Fixes

  • apply custom constraint class validation to each item in the array (#295) (5bb704e), closes #260

Features

  • add isLatLong, isLatitude, isLongtitude validators (#427) (3fd15c4), closes #415
  • add IsObject and IsNotEmptyObject new decorators (#334) (0a41aeb)
  • support ES6 Map and Set for regular validators with each option (#430) (a055bba), closes #428

0.10.1 (2019-09-25)

Bug Fixes

  • add default message for isMilitaryTime validator (#411) (204b7df), closes #287
  • add default message for isPort validator (#404) (74e568c)
  • add locale parameter for isAlpha and isAlphanumeric validat… (#406) (2f4bf4e)

Features

  • add skipUndefinedProperties, skipNullProperties options (#414) (76c948a), closes #308

0.10.0 (2019-08-10)

Bug Fixes

  • add correct signature for custom error message handler (249c41d)

Features

  • add IsISO31661Alpha3 and IsISO31661Alpha2 validators (#273) (55c57b3)
  • IsDecimal: implement IsDecimal from validatorjs (#359) (b4c8e21)
  • add isPort decorator (#282) (36684ec)
  • allow validate Map/Set (#365) (f6fcdc5)
  • new ValidatePromise decorator - resolve promise before validate (#369) (35ec04d)
  • replace instanceof Promise and support Promise/A+ (#310) (59eac09)
  • isNumberString now accept validator.js IsNumericOptions as second parameter (#262)

BREAKING CHANGES

  • update @types/validator from 10.4.0 to version 10.11.2 - please check it's changelog (cb960dd)
  • isDateString now check to match only entire ISO Date (#275) (5012464)
  • remove IsCurrencyOptions, IsURLOptions, IsEmailOptions, IsFQDNOptions interfaces and replace with interfaces from @types/validator

Features

  • added option to pass custom context for the decorators

Bug Fixes

  • validating against a schema will validate against that one instead of every registered one

0.9.0 [BREAKING CHANGE]

Features

  • updated validator.js from 9.2.0 to 10.4.0 (Check it's changelog for what has changed.)
    • until now fractional numbers was not allowed in the IsNumberString decorator, now they are allowed
    • until now Gmail addresses could contain multiple dots or random text after a + symbol, this is not allowed anymore
  • IsPhoneNumber decorator has been added which uses the google-libphonenumber library to validate international phone numbers accurately

Bug Fixes

  • update IsURLOptions to match underlying validator host list options
  • added a console warning when no metadata decorator is found as it's possibly not intended
  • the Min and Max decorator will corectly show an inclusive error message when failing
  • fixed a runtime error when validationArguments.value is not a string

Bug Fixes

  • remove ansicolor package, because it's incompatible with IE

Features

  • ValidatorOptions now has a forbidUnknownValues key to prevent unknown objects to pass validation
    • it's highly advised to turn this option on
    • now this option defaults to false but will be default to true after the 1.0 release

Bug Fixes

  • handle when target property is undefined when calling ValidationError.toString()

Features

  • added ValidationError.toString() method for easier debugging
  • added printError method to pretty-print errors in NodeJS or the browser

Bug Fixes

  • fixed wrong type info in ValidatorOptions
  • fixed wrong type info in ValidationSchema (the options key now is optional)
  • corrected IsNumericString to IsNumberString in the README
  • fixed type of host_whitelist and host_backlist in IsURLOptions

Bug Fixes

  • fixed wrong type info in ValidatorOptions

0.8.0 [BREAKING CHANGE]

Features

  • updated validator.js from 7.0.0 to 9.2.0 (Check it's changelog for what has changed.)

    This caused breaking change, if you used the IsUrl decorator to validate localhost as a valid url, from now you must use the require_tld: false option

    @IsUrl({ require_tld: false})
    url: string;
  • added @IsInstance decorator and validator.isInstance(value, target) method.

  • changed @IsNumber decorator has been changed to @IsNumber(options: IsNumberOptions)

  • added option to strip unknown properties (whitelist: true)

  • added option to throw error on unknown properties (forbidNonWhitelisted: true)

  • added @Allow decorator to prevent stripping properties without other constraint

Bug Fixes

  • fixed issue with @IsDateString now it allow dates without fraction seconds to be set
  • fixed issue with @IsDateString now it allow dates without with timezones to be set
  • @ValidateNested correctly generates validation error on non object and non array values

0.6.7

Bug Fixes

  • fixed issue with @ValidateNested when nested property is not defined and it throw an error (#59)

0.6.5

Bug Fixes

  • fixed bugs with @IsUrl, @IsEmail and several other decorators

0.6.4

Features

  • added @IsMilitaryTime decorator.

0.6.3

Features

  • added validateOrReject method which rejects promise instead of returning array of errors in resolved result

0.6.1

Features

  • added @IsArray decorator.

0.6.0 [BREAKING CHANGE]

Features

  • breaking change with @ValidateNested on arrays: Validator now groups the validation errors by sub-object, rather than them all being grouped together. See #32 for a demonstration of the updated structure.
  • added @ValidateIf decorator, see conditional validation in docs.

0.5.0 [BREAKING CHANGE]

Features

  • async validations must be marked with { async: true } option now.

    This is optional, but it helps to determine which decorators are async to prevent their execution in validateSync method.

  • added validateSync method that performs non asynchronous validation and ignores validations that marked with async: true.

  • there is a breaking change in registerDecorator method. Now it accepts options object.

  • breaking change with @ValidatorConstraint decorator. Now it accepts option object instead of single name.

0.4.1

Bug Fixes

  • fixed issue with wrong source maps packaged

0.4.0 [BREAKING CHANGE]

Features

  • everything should be imported from "class-validator" main entry point now
  • ValidatorInterface has been renamed to ValidatorConstraintInterface
  • contain can be set in the main entry point now
  • some decorator's names changed. Be aware of this
  • added few more non-string decorators
  • validator now returns array of ValidationError instead of ValidationErrorInterface. Removed old ValidationError
  • removed all other validation methods except validator.validate
  • finally validate method is async now, so custom async validations are supported now
  • added ability to validate inherited properties
  • added support of separate validation schemas
  • added support of default validation messages
  • added support of special tokens in validation messages
  • added support of message functions in validation options
  • added support of custom decorators
  • if no groups were specified, decorators with groups now are being ignored
  • changed signature of the ValidationError. Now if it has nested errors it does not return them in a flat array

Bug Fixes

  • fixed all decorators that should not work only with strings

0.3.0

Features

  • package has changed its name from validator.ts to class-validator.
  • sanitation functionality has been removed from this library. Use class-sanitizer instead.