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

Add support for functions with type annotations #63

Closed
abustany opened this issue Nov 27, 2018 · 0 comments
Closed

Add support for functions with type annotations #63

abustany opened this issue Nov 27, 2018 · 0 comments

Comments

@abustany
Copy link

It looks like the API used by Flask-JsonRPC to inspect functions (as of version 0.3.1) is not compatible with typing annotations...

Example:

@jsonrpc.method('Test.Ping')
def ping() -> str:
    return 'pong'

causes the following exception:

Traceback (most recent call last):
  File "./test.py", line 17, in <module>
    class Server:
  File "./test.py", line 29, in Server
    def ping() -> str:
  File "/home/abustany/test/.direnv/python-3.7.1/lib/python3.7/site-packages/flask_jsonrpc/__init__.py", line 225, in decorator
    arg_names = getargspec(f)[0]
  File "/usr/lib64/python3.7/inspect.py", line 1080, in getargspec
    raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use getfullargspec() API which can support them
nycholas added a commit that referenced this issue Jun 13, 2020
* Add support for type annotations
* Add support a Flask Blueprint
* Add support a Python >= 3.5
* Add support a Flask >= 1.0.0
* Fix few bugs
* Prepare for release 1.0.0, ;)

Resolve: #63 #68 #59
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