open-api
open-api copied to clipboard
Support for Asynchronous Custom Keywords in openapi-request-validator
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:
- Make the validation method in openapi-request-validator asynchronous.
- 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.