ajv-validator/ajv-errors

Be able to set custom keyword for error messages

davis90 opened this issue · 1 comments

Hi!

Thanks for your great libraries. It's cool to work with.

Being able to define the key for the error messages could be nice.

maybe something like:

import Ajv from 'ajv'
import ajvErrors from 'ajv-errors'

let ajv = new Ajv({ allErrors: true })
ajv = ajvErrors(ajv, { keyword: "myCustomErrorMessage" })

what is your opinion about that?

thank for all!

This would be useful with OpenAPI-based schema inputs since OpenAPI expects all custom properties to start with x-, so being able to use x-errorMessage would be nice.

If this is something the maintainers like, I could look at implementing.