Skip to content

feat: delegate generated client boilerplate helpers to google-api-core#17706

Closed
hebaalazzeh wants to merge 38 commits into
mainfrom
feat/gapic-generator-centralization-v2
Closed

feat: delegate generated client boilerplate helpers to google-api-core#17706
hebaalazzeh wants to merge 38 commits into
mainfrom
feat/gapic-generator-centralization-v2

Conversation

@hebaalazzeh

Copy link
Copy Markdown
Contributor

Description

This draft PR updates the GAPIC generator templates to delegate common, service-agnostic boilerplate logic to the newly centralized functions in google-api-core.gapic_v1.

Related PR: #17628

Key Changes:

  • Deduplication via Delegation: The generator templates for client.py have been updated so that boilerplate helper methods (such as _use_client_cert_effective, _get_api_endpoint, and _get_default_mtls_endpoint) now delegate their implementations to the centralized api-core functions (e.g., _client_cert.use_client_cert_effective()).
  • Backward Compatibility: Rather than removing the internal _-prefixed methods from the generated clients entirely, we retain their definitions and signatures but delegate their logic. This ensures 100% backward compatibility for any existing code that might be monkey-patching or relying on these internal client methods.
  • Temporary Dependency Override: For testing purposes, the google-api-core dependency in setup.py has been temporarily pinned to the feat/gapic-centralization-api-core branch.

Purpose of this Draft PR:
Running the showcase and unit tests against this draft PR will provide end-to-end integration verification that the google-api-core centralization branch works perfectly with generated code before we officially merge it.

hebaalazzeh and others added 30 commits June 30, 2026 06:42
…rs.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Splits the monolithic client_helpers.py into routing.py, client_cert.py, config_helpers.py, and method_helpers.py to improve readability and maintainability.
Updates gapic_v1 exports and test imports accordingly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request centralizes several GAPIC client helper methods (such as mTLS endpoint conversion, client certificate resolution, environment variable reading, universe domain resolution, and request ID setup) from the generated client templates into google-api-core under google.api_core.gapic_v1. The generated client templates are refactored to delegate to these centralized helpers, and their corresponding unit tests are moved from the generator templates to google-api-core. Additionally, dependencies in the generator are updated to point to the centralization branch of google-api-core, and test environments are isolated from workstation mTLS settings. I have no feedback to provide as there are no review comments.

@hebaalazzeh hebaalazzeh deleted the feat/gapic-generator-centralization-v2 branch July 14, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant