Add support for functions with type annotations
abustany opened this issue · comments
Adrien commented
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