Description
Is your feature request related to a problem? Please describe.
It could be great to use OpenAPIValidator mecanism to generate an AJV object and use it outside of an OpenAPI and Express usage.
Users could have the guarantee that validation and transformation (serdes) are the same in their OpenAPI usage and when they validate a JSON.
For example, it would be possible to develop a new module that plugin on express-openapi-validator and that uses his request AJV in order to validate request received from Websocket.
I could develop a new module for that with socket.io.
Describe the solution you'd like
In addition to middleware
function, we would have a new ajv
function in OpenAPIValidator.
This function could use the same init mecanism and return request AJV.
Then this AJV could be used by client.
I developed it.
I'm going to add a pull request for that and I'll be able to change some things with your recommandations.
Describe alternatives you've considered
As initialization return a list of express middleware and not objects that can be called, I don't see a lot of other ways to do that.