Subclass JSONSerializable from JSONRPC20BatchRequest and JSONRPC20BatchResponse to allow usage of JSONSerializable's methods serialize and deserialize.
Decouple request validation from JSONRPCResponseManager's handle method and introduce a static method inside JSONRPCResponseManager named deserialize (analogous to JSONSerializable).
Benefits
These changes allow to change the serialization and deserialization methods used by the library without overwriting its logic. (e.g. use cbor2.loads / cbor2.dumps instead of json.loads / json.dumps)
Description of the Change
Subclass JSONSerializable from JSONRPC20BatchRequest and JSONRPC20BatchResponse to allow usage of JSONSerializable's methods
serialize
anddeserialize
.Decouple request validation from JSONRPCResponseManager's
handle
method and introduce a static method inside JSONRPCResponseManager nameddeserialize
(analogous to JSONSerializable).Benefits
These changes allow to change the serialization and deserialization methods used by the library without overwriting its logic. (e.g. use
cbor2.loads
/cbor2.dumps
instead ofjson.loads
/json.dumps
)