When adding async support for Flask-Parameter-Validation, the ValidateParameters decorator would always return an async coroutine, whether the Flask view function was async or not. This resulted in unexpected behavior when adding decorators that wrapped ValidateParameters as they may not have been expecting an async function that must be awaited.
To fix this, ValidateParameters now only returns an async coroutine to any decorators upstream if it recieved an async coroutine. Otherwise, it will return a function.
I've added a good few tests to make sure async and sync decorators are handled predictably across types and parameter types.
When adding async support for Flask-Parameter-Validation, the ValidateParameters decorator would always return an async coroutine, whether the Flask view function was async or not. This resulted in unexpected behavior when adding decorators that wrapped ValidateParameters as they may not have been expecting an async function that must be awaited.
To fix this, ValidateParameters now only returns an async coroutine to any decorators upstream if it recieved an async coroutine. Otherwise, it will return a function.
I've added a good few tests to make sure async and sync decorators are handled predictably across types and parameter types.