Skip to content

Missing import in **/types/__init__.py for certain enums #1943

@parthea

Description

@parthea

See the link to the generated code below for google/cloud/aiplatform/v1beta1 where the import statement for AcceleratorType is missing in google/cloud/aiplatform_v1beta1/types/__init__.py.

https://github.com/googleapis/googleapis-gen/blob/6b2c01cabe29e8c7de08852efaef631ff18d62b4/google/cloud/aiplatform/v1beta1/aiplatform-v1beta1-py/google/cloud/aiplatform_v1beta1/types/__init__.py#L850C6-L850C21

See the definition for AcceleratorType in the proto here:
https://github.com/googleapis/googleapis/blob/2fd7625cf9808234503fd5addc6e2bda8fe5c114/google/cloud/aiplatform/v1beta1/accelerator_type.proto#L28

The init file should have

from .accelerator_type import (
    AcceleratorType,
)

The issue is that enums which are not part of messages are not added to __init__.py because of the proto.messages conditional check

{% for _, proto in api.protos|dictsort if proto.file_to_generate and proto.messages %}
from .{{proto.module_name }} import (
{% for _, message in proto.messages|dictsort %}
{{message.name }},
{% endfor %}
{% for _, enum in proto.enums|dictsort %}
{{ enum.name }},
{% endfor %}
)
{% endfor %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions