Additional validators for class-validator.
Use your favorite package manager to install:
npm install class-validator-extended
For obvious reasons, class-validator needs to be installed.
Just use the decorators like any of the built-in ones:
import { ArrayMinSize } from 'class-validator'
import { ArrayMonotonic } from 'class-validator-extended'
class Foo {
@ArrayMinSize(2)
@ArrayMonotonic()
values: [1, 13, 42]
}
If you don't have Dayjs installed you need to use the minimal
export:
import { MaxBigInt } from 'class-validator-extended/dist/minimal'
Please note that Dayjs is an optional dependency and will by default be installed by npm and yarn. To avoid this use npm install --omit optional
or yarn install --ignore-optional
, respectively.
For detailed information please read the API docs.