apache / apache/pulsar-client-python

[Bug] Nested arrays decoding not working as expected

Đang mở
#172 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
75
Fork
53
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Version
OS: Ubuntu 22.04
Python: 3.10.2
Pulsar: pulsar-client==3.2.0

### Minimal reproduce step
```python3
from pulsar.schema import JsonSchema, Record, Array, String

class A(Record):
a = String()

class B(Record):
b = Array(Array(A()))

# Decode JSON data
json_data = '{"b": [[{"a": "hello world"}]]}'
decoded_data = JsonSchema(B).decode(json_data)

# Access the nested objects
nested_objects = decoded_data.b[0][0]
print(type(nested_objects))
print(nested_objects.a)
```

### What did you expect to see?
```
<__main__.A object at 0x7fd1ecd07d00>
hello world
```

### What did you see instead?
```

Traceback (most recent call last):
File "", line 1, in
AttributeError: 'dict' object has no attribute 'a'
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.