I am using Global Pipes to do the validation of the dto , as the data coming from the client side have some field, and that field is getting modified or added to the request object through the interceptor, (modified field is coming from the db service) as interceptor runs before the pipe so the pipe is not giving me error that the field is missing, please suggest me some ideas to implement the validation of the dto
#Nestjs : Best possible way to validate client data
23 messages · Page 1 of 1 (latest)
Suggestion for: @fervent gulch
Please do not cross post.
Please refrain from posting your question in multiple channels, or linking the channel elsewhere.
If someone knew topic A, they would be in the topic A channel. Asking in irrelevant channels is just spam.
Please be patient waiting for an answer, it may take time for someone with adequate knowledge to answer your question, furthermore, make sure that your question is well-structured.
We use class-validator.
you say you want best, class-validator is the worst
Is it really better than class validator?
Why do you say that this one is better ? I would like to know
Can you share your points ?
You don't read docs? go and wipe slippers in the street if you're that lazy 🙂
You've got to be kidding me...
And it's a very unfunny and tasteless joke.
No not me, the author of that lib. Or oyu not about 20 000x but about slippers... oh ah
boring
I see
Yes, usually these "828384773x faster, better this and that" libs are all fugazi.
@silk sand https://dev.to/samchon I bet you see a pattern there
It looks to me that if you skip json validation you can have more speed of course
I spent these 2 days writing my own decorator-based validator, I managed to do it without using any significant loop, practically o(1). Later I'll write an article about it, it turned out cool I think.
JSON.parse usually takes up the most time so unless you don't write your own JSON parser I guess that might be the reason why there are faster ways
Can you give a look ?
I didn't do any transformation, just validation, but I think it's cool, if the person doesn't want to use class validator anymore.
You can do something much better using some better data structures like Map and Set, well, now that I managed to do it pretty well, just keep improving and over time it will get better and better.