[X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.26.1
Plugin version
2.5.1
Node.js version
21.7.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Docker node:latest
Description
Current plugin does not allow ajv instances created with non-draft 7 schemas to be used like:
ajv/dist/2019
ajv/dist/2020
Steps to Reproduce
import ajvNew from 'ajv/dist/2020.js';
export default fp(async (fastify) => {
const ajv = new ajvNew.default();
await fastify.register(response_validation, {
ajv
});
}
### Expected Behavior
Expect it to use my ajv instance internally. Right now the check for setting the ajv instance is:
if (opts.ajv && opts.ajv instanceof Ajv) {
However, this fails for this case since the ajv I am passing in is not of type Ajv.
Prerequisites
Fastify version
4.26.1
Plugin version
2.5.1
Node.js version
21.7.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Docker node:latest
Description
Current plugin does not allow ajv instances created with non-draft 7 schemas to be used like: ajv/dist/2019 ajv/dist/2020
Steps to Reproduce
if (opts.ajv && opts.ajv instanceof Ajv) {