You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/19 00:49:21 UTC

[pulsar] 06/26: Handle subrecords in JsonSchema encoding (#4023)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit ab7887a6e48784df363e2aae8f83f6325a3a8565
Author: Yoann Ciabaud <yc...@users.noreply.github.com>
AuthorDate: Fri Apr 12 02:09:21 2019 +0200

    Handle subrecords in JsonSchema encoding (#4023)
---
 pulsar-client-cpp/python/pulsar/schema/schema.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulsar-client-cpp/python/pulsar/schema/schema.py b/pulsar-client-cpp/python/pulsar/schema/schema.py
index 91250a8..260d7b0 100644
--- a/pulsar-client-cpp/python/pulsar/schema/schema.py
+++ b/pulsar-client-cpp/python/pulsar/schema/schema.py
@@ -80,7 +80,7 @@ class JsonSchema(Schema):
 
     def encode(self, obj):
         self._validate_object_type(obj)
-        return json.dumps(obj.__dict__, indent=True).encode('utf-8')
+        return json.dumps(obj.__dict__, default=lambda o: o.__dict__, indent=True).encode('utf-8')
 
     def decode(self, data):
         return self._record_cls(**json.loads(data))