You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/04 14:20:38 UTC
[GitHub] [pulsar] HugoPelletier opened a new issue #11558: [Python Schema] Record can not be None
HugoPelletier opened a new issue #11558:
URL: https://github.com/apache/pulsar/issues/11558
**Describe the bug**
If you have a sub-record in your schema, the sub-record cannot be `None` despite the fact that the Record class initialization has a `required` field set to [False by default](https://github.com/apache/pulsar/blob/master/pulsar-client-cpp/python/pulsar/schema/definition.py#L60).
**To Reproduce**
```python
class NestedObj2(Record):
na2 = Integer()
class ComplexRecord(Record):
a = Integer()
nested = NestedObj2()
data_schema = AvroSchema(ComplexRecord)
r = ComplexRecord(a=1)
data_encode = data_schema.encode(r)
```
Will raise an exception
```
TypeError: Invalid type '<class 'NoneType'>' for sub-record field 'nc2'. Expected: <class '....NestedObj1'>
```
**Expected behavior**
Should be able to set sub-record to None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] merlimat closed issue #11558: [Python Schema] Record can not be None
Posted by GitBox <gi...@apache.org>.
merlimat closed issue #11558:
URL: https://github.com/apache/pulsar/issues/11558
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] merlimat closed issue #11558: [Python Schema] Record can not be None
Posted by GitBox <gi...@apache.org>.
merlimat closed issue #11558:
URL: https://github.com/apache/pulsar/issues/11558
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org