#class-validation with nestjs

7 messages · Page 1 of 1 (latest)

teal yacht
#

I am interested in how this works since I am currently making a dto validation lib that should be able to work everywhere. I am reading the class-validation documentation and see that they call validate(dto) in order to get the validity of the dto. Does this mean that nest calls this function behind the sceens when useing the validationPipe mentioned here:
https://docs.nestjs.com/techniques/validation
Thus meaning it cant use any other validation library?

For context I made this package for react based codebases but im finding it works well everywhere. However dtos and their implementation in nest is just awesome so im trying to add that into my code. while being significantly lighter weight then class-validator.
https://www.npmjs.com/package/ducktyper

marsh pivot
#

ValidationPipe is just a pipe

#

you can build your own pipe

#

I've been using Joi like this. I didn't use the built-in ValidationPipe

#

my ValidationPipe looks like this