Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map field message definitions do not consistently use module alias disambiguation #618

Closed
software-dov opened this issue Sep 24, 2020 · 0 comments · Fixed by #654 or #1133
Closed
Assignees
Labels
generator Bugs, features, and so forth pertaining to the generated client surface priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@software-dov
Copy link
Contributor

This is visible with Bigtable Admin. The generation produces output and generates no errors, but the generated unit tests fail.

    from .bigtable_instance_admin import (CreateInstanceRequest, GetInstanceRequest, ListInstancesRequest, ListInstancesResponse, PartialUpdateInstanceRequest, DeleteInstanceRequest, CreateClusterRequest, GetClusterRequest, ListClustersRequest, ListClustersResponse, DeleteClusterRequest, CreateInstanceMetadata, UpdateInstanceMetadata, CreateClusterMetadata, UpdateClusterMetadata, CreateAppProfileRequest, GetAppProfileRequest, ListAppProfilesRequest, ListAppProfilesResponse, UpdateAppProfileRequest, DeleteAppProfileRequest, UpdateAppProfileMetadata, )
google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py:55: in <module>
    class CreateInstanceRequest(proto.Message):
google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py:88: in CreateInstanceRequest
    message=instance.Cluster,
E   AttributeError: 'Field' object has no attribute 'Cluster

In the above stacktrace, message=instance.Cluster should be message=gba_instance.Cluster.

@software-dov software-dov added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. generator Bugs, features, and so forth pertaining to the generated client surface labels Sep 24, 2020
@software-dov software-dov self-assigned this Sep 24, 2020
software-dov added a commit to software-dov/gapic-generator-python that referenced this issue Oct 13, 2020
This was noticed when attempting to generate Bigtable Admin in a
message definition: an imported module is given an alias to prevent
collision with a field name. When the module is referenced to describe
the type of a singleton field it is properly disambiguated. When used
to describe the type of a MapField it is _not_ disambiguated.

Fix for that.

Closes googleapis#618
software-dov added a commit that referenced this issue Oct 13, 2020
…#654)

This was noticed when attempting to generate Bigtable Admin in a
message definition: an imported module is given an alias to prevent
collision with a field name. When the module is referenced to describe
the type of a singleton field it is properly disambiguated. When used
to describe the type of a MapField it is _not_ disambiguated.

Fix for that.

Closes #618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Bugs, features, and so forth pertaining to the generated client surface priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
1 participant