Async validator for custom formats
Is your feature request related to a problem? Please describe.
I'd like to use this project to do validation of resource IDs against our database. For example: We could have user_id as a custom swagger format, and allow the validate function to call an async function isValidUserId before the request succeeds.
This would save a ton of repeated code, especially in larger APIs where resource IDs are passed around in many parts of many requests.
Another use case would be checking that the scopes of the IDs that are passed match the bearer token given. For example: In a Todo List App, we could have a custom swagger format todolist_id included in the request, along with a JWT that includes a user_id claim. To validate requests, we need to check that the user_id is linked in DB to the todolist_id. If we could do this off of the openAPI spec, this would also save a ton of repeated code.
Describe the solution you'd like Allow formats.validate to be an async function
Describe alternatives you've considered So far we're implementing this ourself as a separate middleware, but it doesn't use the swagger spec so it doesn't happen automatically.
Thanks for the work! Also open to alternatives if anyone has tried to solve these same problems.
Update - I tried to get this working using the validateSecurity handlers since they support async, but I can't even get them to run (#539)..