Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom parameters' validators #234

Closed
antispam2002 opened this issue May 23, 2022 · 2 comments
Closed

Support for custom parameters' validators #234

antispam2002 opened this issue May 23, 2022 · 2 comments

Comments

@antispam2002
Copy link

antispam2002 commented May 23, 2022

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)

in dispatcher.py

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
Copy link
Member

bcb commented May 23, 2022

Yes - great idea. I will actually add this this week, for version 6.

@bcb
Copy link
Member

bcb commented Feb 26, 2023

Added to version 6

@bcb bcb closed this as completed Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants