Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

class-validator

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-validator - npm Package Versions

23
6

0.14.1

Diff

Changelog

Source

0.14.1 (2024-01-12)

Added
  • allow specifying options for @IsBase64 decorator (#1845) , closes #1013
  • use official type for version in @IsUUID decorator (#1846) , closes #1497
  • update @IsPhoneNumber decorator to use max dataset (#1857)
Fixed
  • fail for non-array constraint in @IsIn decorator (#1844) , closes #1693
  • allow number and boolean values in validation message "$value" tokens (#1467) , closes #921, #1046
  • read nullable option in @IsNotEmptyObject decorator correctly (#1555) , closes #1554
Changed
  • update libphonenumber-js to ^1.10.53 from ^1.10.14
  • update various dev-dependencies
typestack-release-bot
published 0.14.0 •

Changelog

Source

0.14.0 (2022-12-09)

Added

  • add @IsTimeZone decorator to check if given string is valid IANA time zone
  • add @IsISO4217CurrencyCode decorator to check if the string is an ISO 4217 currency code
  • add @IsStrongPassword decorator to check if given password matches specific complexity criteria
  • add @IsBase58 decorator to check if a string is base58 encoded
  • add @IsTaxId decorator to check if a given string is a valid tax ID in a given locale
  • add support for passing function as date generator in @MinDate and @MaxDate decorators
  • add option to print constraint error message instead of constraint type in validation error
  • improve decorator metadata lookup performance
  • return possible values in error message for @IsEnum decorator

Fixed

  • re-added @types/validator as dependency
  • fix error generation when using @NestedValidation
  • pass validation options correctly to validator in @IsDateString decorator
  • support passing Symbol as parameter in error message generation
  • specify supported locales for @IsAlphanumeric decorator
  • correctly assign decorator name in metadata instead of loosing it
  • fix various spelling errors in documentation
  • fix various spelling errors and inconsistencies in JSDoc for decorators

Changed

  • enable forbidUnknownValues option by default
  • remove documentation about deprecated schema based validation and added warning
  • update warning message logged about missing decorator metadata
  • update libphonenumber-js to ^1.10.14 from ^1.9.43
  • update various dev-dependencies

BREAKING CHANGES

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:

  • when attempting to validate a class instance without metadata for it
  • when using group validation and the specified validation group results in zero validation applied

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.

typestack-release-bot
published 0.13.2 •

Changelog

Source

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.

Fixed
  • switched to use Array.isArray in array checks from instanceof operator
Changed
  • libphonenumber-js package updated to 1.9.43 from 1.9.7
  • validator package updated to 13.5.2 from 13.5.2
  • various dev-dependencies updated
typestack-release-bot
published 0.13.1 •

Changelog

Source

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
typestack-release-bot
published 0.13.0 •

Changelog

Source

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
vlapo
published 0.12.2 •

Changelog

Source

0.12.2 (2020-04-23)

Fixed
  • move tslib from peerDependencies to dependencies (827eff1), closes #588
vlapo
published 0.12.1 •

Changelog

Source

0.12.1 (2020-04-18)

Fixed
  • apply only nested validator for ValidateNested multi-dimensional array (c463be5)
vlapo
published 0.12.1-rc.0 •

vlapo
published 0.12.0 •

Changelog

Source

0.12.0 (2020-04-18)

Fixed
Changed
Added
  • 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).

vlapo
published 0.12.0-refactor.5 •

23
6
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc