WIP - #17999
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the templates to conditionally import several helper functions (get_default_mtls_endpoint, get_api_endpoint, get_universe_domain, and transcode_request) from google.api_core if available, falling back to local implementations on ImportError. It also updates the client template to explicitly pass default_universe="googleapis.com" to get_universe_domain. The feedback correctly points out that the fallback implementation of get_universe_domain in _compat.py.j2 is missing the default value for default_universe, which breaks compatibility with the original signature and the google.api_core version.
| def get_universe_domain( | ||
| *potential_universes: Optional[str], | ||
| default_universe: str, | ||
| ) -> str: |
There was a problem hiding this comment.
The fallback implementation of get_universe_domain is missing the default value for default_universe (default_universe: str = DEFAULT_UNIVERSE). This breaks compatibility with the original signature and with google.api_core.universe.get_universe_domain, which makes default_universe optional. Please restore the default value to ensure it remains a drop-in replacement.
def get_universe_domain(
*potential_universes: Optional[str],
default_universe: str = DEFAULT_UNIVERSE,
) -> str:
revisit once new version of api core released