googleapis / googleapis/google-cloud-python

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

Ouverte
#13,479 4 commentaires 0 réactions 1 personne assignée Assignée à @ohmayr Voir sur GitHub
needs more info priority: p1 type: docs type: process
Langage dominant
Python
Étoiles
5.4k
Forks
1.8k
Merge moyen
3 j 4 h
PR mergées (30 j)
122

Description

### 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.