Support for custom parameters' validators
Closed this issue · 2 comments
antispam2002 commented
Currently, the parameters' validation is bound to
try:
signature(func).bind(*extract_args(request, context), **extract_kwargs(request))
except TypeError as exc:
return Left(InvalidParamsResult(str(exc)))
return Right(func)
This validation checks if the method's signature is compatible with provided parameters. However, there is no easy way to interfere in this validation, e.g. to provide own error messages, etc.
Would be very nice to have a way to specify some custom parameters' validation callable/class/etc when annotating a method with @method decorator.
bcb commented
Yes - great idea. I will actually add this this week, for version 6.
bcb commented
Added to version 6