#Nestjs : Best possible way to validate client data

23 messages · Page 1 of 1 (latest)

fervent gulch
#

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

plucky lavaBOT
#

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.

grave remnant
proper solstice
#

We use class-validator.

grave remnant
muted night
silk sand
#

Can you share your points ?

grave remnant
silk sand
#

And it's a very unfunny and tasteless joke.

grave remnant
#

boring

silk sand
#

I see

#

Yes, usually these "828384773x faster, better this and that" libs are all fugazi.

hybrid dock
#

It looks to me that if you skip json validation you can have more speed of course

silk sand
hybrid dock
#

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

silk sand
#

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.

silk sand
#

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.