jsonrpcserver
jsonrpcserver copied to clipboard
Support for custom parameters' validators
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.
Yes - great idea. I will actually add this this week, for version 6.
Added to version 6