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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to