[X] I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Please provide the ability to pass in your own Ajv instance.
Motivation
Currently, one can only pass in ajv options, and the plugin instantiates ajv.
But to use latest drafts of JSON Schema, one has to import a different Ajv class than the default export: https://ajv.js.org/json-schema.html#draft-2020-12
In Fastify request validation, this is possible with setCompileFactory(), but it won't work for response validation.
Prerequisites
🚀 Feature Proposal
Please provide the ability to pass in your own Ajv instance.
Motivation
Currently, one can only pass in
ajv
options, and the plugin instantiatesajv
. But to use latest drafts of JSON Schema, one has to import a differentAjv
class than the default export: https://ajv.js.org/json-schema.html#draft-2020-12In Fastify request validation, this is possible with
setCompileFactory()
, but it won't work for response validation.Example