I'm writing a validation schema for a serverless endpoint using ajv and this @middy/validator middleware. There is a note in documentation that the middleware can use external plugins. But it's not clear how to apply them, and there is no example. I want to use ajv-errors
plugin for custom error messages, https://github.com/ajv-validator/ajv-errors.
Please drop me a link about how to apply an external plugin or give me an example. Thanks in advance!
I´m not familiar with ajv but I´ve used middy/validator.
Assuming you have a lambda function that expectes a JSON body and has the next simple code (just returns the JSON body received):
My suggestion (and what worked for me) is the following:
Where "yourSchema" is the validation schema you built.