googleapis / googleapis/google-cloud-python

Incorrect type referenced for `aspect.data` in google.cloud.dataplex_v1 client library documentation

Đang mở
#13,479 4 bình luận 0 reaction 1 người được giao Được giao cho @ohmayr Xem trên GitHub
needs more info priority: p1 type: docs type: process
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

### Determine this is the right repository

- [x] I determined this is the correct repository in which to report this bug.

### Summary of the issue

**Context**
The `google-cloud-dataplex` package [depends on](https://github.com/googleapis/google-cloud-python/blob/b165f923cdf47fbb23757531145eace0e3f088cb/packages/google-cloud-dataplex/setup.py#L46) a protobuf wrapper package called `proto-plus`. Recent versions of the `proto-plus` dependency change the expected types of some `google.cloud.dataplex_v1` objects.

In particular, when using `proto-plus >= 1.24`, the type of `google.cloud.dataplex_v1.Aspect.data` is `proto.marshal.collections.maps.MapComposite` rather than the [documented](https://cloud.google.com/python/docs/reference/dataplex/latest/google.cloud.dataplex_v1.types.Aspect) `google.protobuf.struct_pb2.Struct`.

**Expected Behavior:**

The type of `google.cloud.dataplex_v1.Aspect.data` should be `google.protobuf.struct_pb2.Struct`. This works with `proto-plus==1.23.0`.
```
>>> from google.cloud import dataplex_v1
>>> client = dataplex_v1.CatalogServiceClient()
>>> entry = client.get_entry(name="my-entry-id")
>>> aspect = entry.aspects["my-aspect-id"]
>>> type(aspect.data)

```

**Actual Behavior:**

The type of `google.cloud.dataplex_v1.Aspect.data` is `proto.marshal.collections.maps.MapComposite` when using `proto-plus>=1.24.0`.
```
>>> from google.cloud import dataplex_v1
>>> client = dataplex_v1.CatalogServiceClient()
>>> entry = client.get_entry(name="my-entry-id")
>>> aspect = entry.aspects["my-aspect-id"]
>>> type(aspect.data)

```

### API client name and version

google-cloud-dataplex v2.6.0

### Reproduction steps: code

file: main.py
```python
from google.cloud import dataplex_v1

project_id = "my-google-cloud-project-id"
project_num = "my-google-cloud-project-number"
location = "my-google-cloud-region"

entry_group_id = "my-dataplex-catalog-entry-group-id"
aspect_type_id = "my-dataplex-catalog-aspect-type-id"
entry_id = "my-dataplex-entry-id"

def reproduce():
client = dataplex_v1.CatalogServiceClient()
entry_name = f"projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}"
entry = client.get_entry(name=entry_name)
aspect = entry.aspects[f"{project_num}.{location}.{aspect_type_id}"]
print(type(aspect.data))

if __name__ == "__main__":
reproduce()
```

### Reproduction steps: supporting files

### Reproduction steps: actual results

``

### Reproduction steps: expected results

``

### OS & version + platform

_No response_

### Python environment

Python 3.10.15

### Python dependencies

google-cloud-dataplex 2.6.0
proto-plus 1.24.0

### Additional context

This problem does not occur when using `proto-plus` v1.23.0.

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.