Uh oh!
There was an error while loading. Please reload this page.
feat: add --resource-name-alias flag to resolve namespace collisions - #16769
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to resolve resource name collisions in the GAPIC generator via a new --resource-name-alias CLI parameter. Key changes include updating the Options and MessageType classes to handle these aliases and implementing a fail-fast collision detection check that raises a ValueError when conflicts occur. Feedback suggests that the generator should raise an error for malformed alias inputs to ensure fail-fast behavior instead of merely issuing a warning.
| try: | ||
| # split(":", 1) ensures we only split on the FIRST colon | ||
| res_path, alias_name = mapping.split(":", 1) |
There was a problem hiding this comment.
The use of split(":", 1) correctly handles cases where the resource path itself might contain a colon. However, if the input string does not contain a colon, this will raise a ValueError. If the current logic in the except block returns an empty value, it should be changed to raise a ProgrammingError to ensure fail-fast behavior for unsupported input formats, rather than silently continuing.
References
- When a function receives parameters of an unsupported type, it should raise an error (e.g.,
ProgrammingError) instead of silently returning empty values. This ensures fail-fast behavior and prevents potential issues with missing parameter values in database operations.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v0.12.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:234b9d1f2ddb057ed7ac6a38db0bf8163d839c65c6cf88ade52530cddebce59e <details><summary>bigquery-magics: v0.15.0</summary> ## [v0.15.0](bigquery-magics-v0.14.0...bigquery-magics-v0.15.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16949) ([fab4e71](fab4e712)) </details> <details><summary>db-dtypes: v1.6.0</summary> ## [v1.6.0](db-dtypes-v1.5.1...db-dtypes-v1.6.0) (2026-05-06) ### Features * enable mypy session for db-dtypes (#16689) ([856731e](856731e1)) </details> <details><summary>gapic-generator: v1.31.0</summary> ## [v1.31.0](gapic-generator-v1.30.14...gapic-generator-v1.31.0) (2026-05-06) ### Features * add `--resource-name-alias` flag to resolve namespace collisions (#16769) ([6fc78e5](6fc78e58)) ### Bug Fixes * pass resource aliases to file-level CommonResources (#16945) ([9652a08](9652a08c)) </details> <details><summary>gcp-sphinx-docfx-yaml: v3.3.0</summary> ## [v3.3.0](gcp-sphinx-docfx-yaml-v3.2.5...gcp-sphinx-docfx-yaml-v3.3.0) (2026-05-06) ### Bug Fixes * provide a hub when traversing a File or Program and no parentPath is given ([@&#8203;simbahax](https://redirect.github.com/simbahax)) - `babel-plugin-transform-block-scoping`, `babel-traverse` - [#&#8203;17737](https://redirect.github.com/babel/babel/pull/17737) \[7.x backport] fix: Rename switch discriminant references when body creates shadowing variable ([@&#8203;magic-akari](https://redirect.github.com/magic-akari)) ([5098df2](5098df26)) * correctly parse type assertions in `extends` clause ([@&#8203;nicolo-ribaudo](https://redirect.github.com/nicolo-ribaudo)) - [#&#8203;17723](https://redirect.github.com/babel/babel/pull/17723) \[7.x backport] fix(parser): improve super type argument parsing ([@&#8203;JLHwung](https://redirect.github.com/JLHwung)) - `babel-traverse` - [#&#8203;17708](https://redirect.github.com/babel/babel/pull/17708) ([5098df2](5098df26)) </details> <details><summary>google-analytics-admin: v0.29.0</summary> ## [v0.29.0](google-analytics-admin-v0.28.0...google-analytics-admin-v0.29.0) (2026-05-06) </details> <details><summary>google-analytics-data: v0.22.0</summary> ## [v0.22.0](google-analytics-data-v0.21.0...google-analytics-data-v0.22.0) (2026-05-06) </details> <details><summary>google-apps-chat: v0.9.0</summary> ## [v0.9.0](google-apps-chat-v0.8.0...google-apps-chat-v0.9.0) (2026-05-06) </details> <details><summary>google-apps-script-type: v0.7.0</summary> ## [v0.7.0](google-apps-script-type-v0.6.0...google-apps-script-type-v0.7.0) (2026-05-06) </details> <details><summary>google-auth: v2.51.0</summary> ## [v2.51.0](google-auth-v2.50.0...google-auth-v2.51.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.8 and 3.9 (#16946) ([dcbdd3b](dcbdd3b4)) </details> <details><summary>google-auth-httplib2: v0.4.0</summary> ## [v0.4.0](google-auth-httplib2-v0.3.1...google-auth-httplib2-v0.4.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.7, 3.8, and 3.9 (#16937) ([b4fa220](b4fa2200)) </details> <details><summary>google-auth-oauthlib: v1.4.0</summary> ## [v1.4.0](google-auth-oauthlib-v1.3.1...google-auth-oauthlib-v1.4.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16939) ([25e2a2d](25e2a2dc)) * replace deprecated `utcfromtimestamp` in google-auth-oauthlib (#16732) ([e1c5af7](e1c5af76)) </details> <details><summary>google-cloud-access-context-manager: v0.5.0</summary> ## [v0.5.0](google-cloud-access-context-manager-v0.4.0...google-cloud-access-context-manager-v0.5.0) (2026-05-06) </details> <details><summary>google-cloud-biglake-hive: v0.2.0</summary> ## [v0.2.0](google-cloud-biglake-hive-v0.1.0...google-cloud-biglake-hive-v0.2.0) (2026-05-06) </details> <details><summary>google-cloud-bigquery-reservation: v1.24.0</summary> ## [v1.24.0](google-cloud-bigquery-reservation-v1.23.0...google-cloud-bigquery-reservation-v1.24.0) (2026-05-06) </details> <details><summary>google-cloud-bigquery-storage: v2.38.0</summary> ## [v2.38.0](google-cloud-bigquery-storage-v2.37.0...google-cloud-bigquery-storage-v2.38.0) (2026-05-06) ### Bug Fixes * provide a hub when traversing a File or Program and no parentPath is given ([@&#8203;simbahax](https://redirect.github.com/simbahax)) - `babel-plugin-transform-block-scoping`, `babel-traverse` - [#&#8203;17737](https://redirect.github.com/babel/babel/pull/17737) \[7.x backport] fix: Rename switch discriminant references when body creates shadowing variable ([@&#8203;magic-akari](https://redirect.github.com/magic-akari)) ([5098df2](5098df26)) * correctly parse type assertions in `extends` clause ([@&#8203;nicolo-ribaudo](https://redirect.github.com/nicolo-ribaudo)) - [#&#8203;17723](https://redirect.github.com/babel/babel/pull/17723) \[7.x backport] fix(parser): improve super type argument parsing ([@&#8203;JLHwung](https://redirect.github.com/JLHwung)) - `babel-traverse` - [#&#8203;17708](https://redirect.github.com/babel/babel/pull/17708) ([5098df2](5098df26)) </details> <details><summary>google-cloud-ces: v0.5.0</summary> ## [v0.5.0](google-cloud-ces-v0.4.0...google-cloud-ces-v0.5.0) (2026-05-06) </details> <details><summary>google-cloud-chronicle: v0.5.0</summary> ## [v0.5.0](google-cloud-chronicle-v0.4.0...google-cloud-chronicle-v0.5.0) (2026-05-06) </details> <details><summary>google-cloud-cloudsecuritycompliance: v0.7.0</summary> ## [v0.7.0](google-cloud-cloudsecuritycompliance-v0.6.0...google-cloud-cloudsecuritycompliance-v0.7.0) (2026-05-06) </details> <details><summary>google-cloud-compute-v1beta: v0.11.0</summary> ## [v0.11.0](google-cloud-compute-v1beta-v0.10.0...google-cloud-compute-v1beta-v0.11.0) (2026-05-06) </details> <details><summary>google-cloud-config: v0.6.0</summary> ## [v0.6.0](google-cloud-config-v0.5.0...google-cloud-config-v0.6.0) (2026-05-06) </details> <details><summary>google-cloud-core: v2.6.0</summary> ## [v2.6.0](google-cloud-core-v2.5.1...google-cloud-core-v2.6.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16953) ([78a48b0](78a48b04)) </details> <details><summary>google-cloud-databasecenter: v0.8.0</summary> ## [v0.8.0](google-cloud-databasecenter-v0.7.0...google-cloud-databasecenter-v0.8.0) (2026-05-06) </details> <details><summary>google-cloud-datacatalog-lineage-configmanagement: v0.2.0</summary> ## [v0.2.0](google-cloud-datacatalog-lineage-configmanagement-v0.1.0...google-cloud-datacatalog-lineage-configmanagement-v0.2.0) (2026-05-06) </details> <details><summary>google-cloud-dataplex: v2.19.0</summary> ## [v2.19.0](google-cloud-dataplex-v2.18.0...google-cloud-dataplex-v2.19.0) (2026-05-06) </details> <details><summary>google-cloud-discoveryengine: v0.19.0</summary> ## [v0.19.0](google-cloud-discoveryengine-v0.18.0...google-cloud-discoveryengine-v0.19.0) (2026-05-06) </details> <details><summary>google-cloud-dns: v0.37.0</summary> ## [v0.37.0](google-cloud-dns-v0.36.1...google-cloud-dns-v0.37.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16954) ([5975c48](5975c481)) </details> <details><summary>google-cloud-documentai-toolbox: v0.16.0</summary> ## [v0.16.0](google-cloud-documentai-toolbox-v0.15.2...google-cloud-documentai-toolbox-v0.16.0) (2026-05-06) </details> <details><summary>google-cloud-gke-hub: v1.24.0</summary> ## [v1.24.0](google-cloud-gke-hub-v1.23.0...google-cloud-gke-hub-v1.24.0) (2026-05-06) </details> <details><summary>google-cloud-iam: v2.23.0</summary> ## [v2.23.0](google-cloud-iam-v2.22.0...google-cloud-iam-v2.23.0) (2026-05-06) </details> <details><summary>google-cloud-kms: v3.13.0</summary> ## [v3.13.0](google-cloud-kms-v3.12.0...google-cloud-kms-v3.13.0) (2026-05-06) </details> <details><summary>google-cloud-memorystore: v0.5.0</summary> ## [v0.5.0](google-cloud-memorystore-v0.4.0...google-cloud-memorystore-v0.5.0) (2026-05-06) ### Features * enable gRPC transport (#16927) ([71b73e5](71b73e54)) </details> <details><summary>google-cloud-modelarmor: v0.6.0</summary> ## [v0.6.0](google-cloud-modelarmor-v0.5.0...google-cloud-modelarmor-v0.6.0) (2026-05-06) </details> <details><summary>google-cloud-ndb: v2.5.0</summary> ## [v2.5.0](google-cloud-ndb-v2.4.2...google-cloud-ndb-v2.5.0) (2026-05-06) ### Features * enable mypy session for ndb (#16691) ([192ccc5](192ccc52)) ### Bug Fixes * Drop support for Python 3.9 (#16950) ([d37a953](d37a9530)) </details> <details><summary>google-cloud-netapp: v0.10.0</summary> ## [v0.10.0](google-cloud-netapp-v0.9.0...google-cloud-netapp-v0.10.0) (2026-05-06) </details> <details><summary>google-cloud-network-management: v1.35.0</summary> ## [v1.35.0](google-cloud-network-management-v1.34.0...google-cloud-network-management-v1.35.0) (2026-05-06) </details> <details><summary>google-cloud-orchestration-airflow: v1.21.0</summary> ## [v1.21.0](google-cloud-orchestration-airflow-v1.20.0...google-cloud-orchestration-airflow-v1.21.0) (2026-05-06) </details> <details><summary>google-cloud-os-login: v2.21.0</summary> ## [v2.21.0](google-cloud-os-login-v2.20.0...google-cloud-os-login-v2.21.0) (2026-05-06) </details> <details><summary>google-cloud-policytroubleshooter-iam: v0.5.0</summary> ## [v0.5.0](google-cloud-policytroubleshooter-iam-v0.4.0...google-cloud-policytroubleshooter-iam-v0.5.0) (2026-05-06) </details> <details><summary>google-cloud-pubsub: v2.38.0</summary> ## [v2.38.0](google-cloud-pubsub-v2.37.0...google-cloud-pubsub-v2.38.0) (2026-05-06) </details> <details><summary>google-cloud-redis-cluster: v0.5.0</summary> ## [v0.5.0](google-cloud-redis-cluster-v0.4.0...google-cloud-redis-cluster-v0.5.0) (2026-05-06) </details> <details><summary>google-cloud-runtimeconfig: v0.37.0</summary> ## [v0.37.0](google-cloud-runtimeconfig-v0.36.1...google-cloud-runtimeconfig-v0.37.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16947) ([e7efd90](e7efd90d)) </details> <details><summary>google-cloud-saasplatform-saasservicemgmt: v0.6.0</summary> ## [v0.6.0](google-cloud-saasplatform-saasservicemgmt-v0.5.0...google-cloud-saasplatform-saasservicemgmt-v0.6.0) (2026-05-06) </details> <details><summary>google-cloud-secret-manager: v2.28.0</summary> ## [v2.28.0](google-cloud-secret-manager-v2.27.0...google-cloud-secret-manager-v2.28.0) (2026-05-06) </details> <details><summary>google-cloud-spanner: v3.66.0</summary> ## [v3.66.0](google-cloud-spanner-v3.65.0...google-cloud-spanner-v3.66.0) (2026-05-06) ### Features * Add last statement option samples (#16499) ([ee09805](ee098051)) ### Bug Fixes * provide a hub when traversing a File or Program and no parentPath is given ([@&#8203;simbahax](https://redirect.github.com/simbahax)) - `babel-plugin-transform-block-scoping`, `babel-traverse` - [#&#8203;17737](https://redirect.github.com/babel/babel/pull/17737) \[7.x backport] fix: Rename switch discriminant references when body creates shadowing variable ([@&#8203;magic-akari](https://redirect.github.com/magic-akari)) ([5098df2](5098df26)) * correctly parse type assertions in `extends` clause ([@&#8203;nicolo-ribaudo](https://redirect.github.com/nicolo-ribaudo)) - [#&#8203;17723](https://redirect.github.com/babel/babel/pull/17723) \[7.x backport] fix(parser): improve super type argument parsing ([@&#8203;JLHwung](https://redirect.github.com/JLHwung)) - `babel-traverse` - [#&#8203;17708](https://redirect.github.com/babel/babel/pull/17708) ([5098df2](5098df26)) </details> <details><summary>google-cloud-speech: v2.39.0</summary> ## [v2.39.0](google-cloud-speech-v2.38.0...google-cloud-speech-v2.39.0) (2026-05-06) </details> <details><summary>google-cloud-storagebatchoperations: v0.7.0</summary> ## [v0.7.0](google-cloud-storagebatchoperations-v0.6.0...google-cloud-storagebatchoperations-v0.7.0) (2026-05-06) </details> <details><summary>google-cloud-testutils: v1.8.0</summary> ## [v1.8.0](google-cloud-testutils-v1.7.1...google-cloud-testutils-v1.8.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16948) ([cdc5dd5](cdc5dd5d)) </details> <details><summary>google-cloud-vision: v3.14.0</summary> ## [v3.14.0](google-cloud-vision-v3.13.0...google-cloud-vision-v3.14.0) (2026-05-06) </details> <details><summary>google-cloud-workflows: v1.22.0</summary> ## [v1.22.0](google-cloud-workflows-v1.21.0...google-cloud-workflows-v1.22.0) (2026-05-06) </details> <details><summary>google-resumable-media: v2.9.0</summary> ## [v2.9.0](google-resumable-media-v2.8.2...google-resumable-media-v2.9.0) (2026-05-06) ### Bug Fixes * Drop support for Python 3.9 (#16938) ([33b5505](33b55050)) </details> <details><summary>google-shopping-merchant-inventories: v1.4.0</summary> ## [v1.4.0](google-shopping-merchant-inventories-v1.3.0...google-shopping-merchant-inventories-v1.4.0) (2026-05-06) </details> <details><summary>google-shopping-merchant-products: v1.6.0</summary> ## [v1.6.0](google-shopping-merchant-products-v1.5.0...google-shopping-merchant-products-v1.6.0) (2026-05-06) </details> <details><summary>google-shopping-merchant-reports: v1.4.0</summary> ## [v1.4.0](google-shopping-merchant-reports-v1.3.0...google-shopping-merchant-reports-v1.4.0) (2026-05-06) </details> <details><summary>googleapis-common-protos: v1.75.0</summary> ## [v1.75.0](googleapis-common-protos-v1.74.0...googleapis-common-protos-v1.75.0) (2026-05-06) </details> <details><summary>proto-plus: v1.28.0</summary> ## [v1.28.0](proto-plus-v1.27.2...proto-plus-v1.28.0) (2026-05-06) </details> <details><summary>sqlalchemy-bigquery: v1.17.0</summary> ## [v1.17.0](sqlalchemy-bigquery-v1.16.0...sqlalchemy-bigquery-v1.17.0) (2026-05-06) ### Bug Fixes * Support Creation of JSON columns (#16733) ([153b82a](153b82a4)) * Drop support for Python 3.8 and 3.9 (#16956) ([63f6d96](63f6d96c)) </details> <details><summary>sqlalchemy-spanner: v1.18.0</summary> ## [v1.18.0](sqlalchemy-spanner-v1.17.3...sqlalchemy-spanner-v1.18.0) (2026-05-06) ### Bug Fixes * correctly parse type assertions in `extends` clause ([@&#8203;nicolo-ribaudo](https://redirect.github.com/nicolo-ribaudo)) - [#&#8203;17723](https://redirect.github.com/babel/babel/pull/17723) \[7.x backport] fix(parser): improve super type argument parsing ([@&#8203;JLHwung](https://redirect.github.com/JLHwung)) - `babel-traverse` - [#&#8203;17708](https://redirect.github.com/babel/babel/pull/17708) ([5098df2](5098df26)) * provide a hub when traversing a File or Program and no parentPath is given ([@&#8203;simbahax](https://redirect.github.com/simbahax)) - `babel-plugin-transform-block-scoping`, `babel-traverse` - [#&#8203;17737](https://redirect.github.com/babel/babel/pull/17737) \[7.x backport] fix: Rename switch discriminant references when body creates shadowing variable ([@&#8203;magic-akari](https://redirect.github.com/magic-akari)) ([5098df2](5098df26)) ### Documentation * fix FAQ grammar in httplib2 example</li> <li><a href="psf/requests@774a0b837a194ee885d4fdd9ca947900cc3daf71"><code>774a0b8</code></a> ([07a610c](07a610c5)) * exclude Response.is_permanent_redirect from API docs (<a href="https://redirect.github.com/psf/requests/issues/7244">#7244</a>)</li> <li><a href="psf/requests@d568f47278492e630cc990a259047c67991d007a"><code>d568f47</code></a> ([07a610c](07a610c5)) * same block as other sections</li> <li><a href="psf/requests@9c72a41bec8597f948c9d8caa5dc3f12273b3303"><code>9c72a41</code></a> Bump github/codeql-action from 4.33.0 to 4.34.1</li> <li><a href="psf/requests@ebf71906798ec82f34e07d3168f8b8aecaf8a3be"><code>ebf7190</code></a> Bump github/codeql-action from 4.32.0 to 4.33.0</li> <li><a href="psf/requests@0e4ae38f0c93d4f92a96c774bd52c069d12a4798"><code>0e4ae38</code></a> ([07a610c](07a610c5)) * clarify Quickstart POST example (<a href="https://redirect.github.com/psf/requests/issues/6960">#6960</a>)</li> <li>Additional commits viewable in <a href="psf/requests@v2.32.5...v2.33.0">compare view</a></li> </ul> </details> <br /> ([07a610c](07a610c5)) * add AGENTS.md for project guidance and development commands</li> <li>Additional commits viewable in <a href="andialbrecht/sqlparse@0.5.3...0.5.4">compare view</a></li> </ul> </details> <br /> ([dbbe4c8](dbbe4c81)) </details> <details><summary>Bulk Changes</summary> * chore: update googleapis and regenerate (#16735) ([542857d](542857d5)) Libraries: google-analytics-admin,google-apps-chat,google-cloud-bigquery-reservation,google-cloud-ces,google-cloud-chronicle,google-cloud-config,google-cloud-databasecenter,google-cloud-dataplex,google-cloud-discoveryengine,google-cloud-iam,google-cloud-kms,google-cloud-modelarmor,google-cloud-netapp,google-cloud-network-management,google-cloud-pubsub,google-cloud-saasplatform-saasservicemgmt,google-shopping-merchant-inventories,google-shopping-merchant-products </details>
Introduces the
--resource-name-aliasCLI flag to allow API ownersto safely disambiguate fully qualified resource paths that flatten
to identical method names in the generated client.
The flag accepts mappings in the format
resource.path/Name:AliasName.The configuration is parsed natively into the compiler Options and
injected into the schema models during construction, avoiding global
state mutations.
Example usage in BUILD.bazel:
Towards: b/505425328