tcalmant / jsonrpclib

A Python (2 & 3) JSON-RPC over HTTP that mirrors the syntax of xmlrpclib (aka jsonrpclib-pelix)
https://jsonrpclib-pelix.readthedocs.io/
Apache License 2.0
53 stars 24 forks source link

Add support for Enum classes #29

Closed tcalmant closed 7 years ago

tcalmant commented 7 years ago

It seems that Enum classes can't be unmarshalled with jsonrpclib. A special treatment should be applied to reload them.

Sample error:

Error instantiating StatusCode: __call__() missing 1 required positional argument: 'value'

Sample JSON-RPC snippet:

{
  "id": "ae15d720-030c-4bd6-b0fa-aa04e71e56ed",
  "method": "service_14.update_status",
  "jsonrpc": "2.0",
  "params": [
    "f72c4f36-3b70-4ea1-85a6-ee6fe482d0d7",
    "bf206cd3-bcd9-4645-8371-0fe871aeef8a",
    {"__jsonclass__": ["beans.StatusCode", []], "_name_": "ERROR", "_value_": 2}
  ]
}