open-api icon indicating copy to clipboard operation
open-api copied to clipboard

Support for Asynchronous Custom Keywords in openapi-request-validator

Open kwakwaversal opened this issue 1 year ago • 0 comments

I'm currently using express-openapi and openapi-request-validator to validate API requests. I'm interested in leveraging custom keywords for validation but noticed in the documentation that asynchronous keywords are not supported:

Each key is the name of a custom keyword. Each value is an AJV keyword definition. Asynchronous keywords are not supported!

Could you provide some background on why async/await is not supported for custom keywords? Is it a design decision or an oversight that could be addressed in a future release?

Proposed Changes

I've looked into the code and have some suggestions on how this could be implemented:

  1. Make the validation method in openapi-request-validator asynchronous.
  2. Add .then/.catch blocks to handle the asynchronous operation in express-openapi around line 134.

I'd be happy to contribute these changes if you think they would be valuable for the project.

kwakwaversal avatar Sep 29 '23 08:09 kwakwaversal