Hello. I would like to have your opinion on how yo...
# help
ö
Hello. I would like to have your opinion on how you validate (basically which package, if any) requests (or better to say request body) that Lambda receives? (for Node.js)
t
I use ajv
Which ultimately just uses jsonschema under the hood
s
You can use middy, JSON validator, which, also uses ajv. I can't really recommend it, I think middy is needlessly complex. Ajv alone would be a couple lines. https://www.npmjs.com/package/@middy/validator
ö
So you recommend using ajv rather than middy validator?
@thdxr @Simon Reilly Reading on middy/validator, they highly encourage to pre compile ajv (I’m not really sure what it means or how to do that).. But when I asked on GitHub ( https://github.com/middyjs/middy/issues/732 ) , I’m told to use this package ( https://github.com/willfarrell/middy-ajv ) instead of
middy/validator
.
From what I read, it seems like
ajv
is pretty slow. Is that so? What about
class-validator
(along with
class-transformer
)?