express-json-validator-middleware icon indicating copy to clipboard operation
express-json-validator-middleware copied to clipboard

Pass Ajv instance to Validator constructor

Open pstadler opened this issue 2 years ago • 1 comments

First of all, thank you for providing this middleware. I've been using it across multiple projects.

How about letting users pass an Ajv instance to Validator? In my case this would be an instance of the 2019-09 draft version[1].

const Ajv2019 = require('ajv/dist/2019')
const ajv = new Ajv2019()

const validator = new Validator(ajv)

[1] https://ajv.js.org/json-schema.html#draft-2019-09

Cheers Patrick

pstadler avatar Jul 08 '22 07:07 pstadler

Glad to hear you're finding this package helpful!

That's a nice idea — if you're able to open a PR for this I'd be very happy to review it.

simonplend avatar Jul 08 '22 13:07 simonplend