chore(generator): delegate request-id setup to public request#17739
chore(generator): delegate request-id setup to public request#17739hebaalazzeh wants to merge 45 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the request ID setup logic in the generated client templates by delegating it to google.api_core.gapic_v1.method_helpers.setup_request_id instead of maintaining an inline implementation. As a result, the redundant unit tests for _setup_request_id have been removed from both the templates and the golden integration tests. There are no review comments, so I have no feedback to provide.
f037044 to
f25d768
Compare
a0bff77 to
613b392
Compare
f25d768 to
71b2f4e
Compare
e02ee4b to
db040bb
Compare
71b2f4e to
a8cc8d8
Compare
|
This implementation makes sense if we plan to bump up the api_core requirement Before merging, we need to:
There's also a chance we will want to keep a fallback implementation to keep supporting old api_core versions |
…lic helpers Introduces method_helpers module containing setup_request_id helper. Exposes the module as public in gapic_v1.
…t and improve docstring
90602cc to
76ac456
Compare
…lic helpers Introduces method_helpers module containing setup_request_id helper. Exposes the module as public in gapic_v1.
Updates generator templates and goldens to import public method_helpers from google-api-core gapic_v1 and call setup_request_id helper. Removes duplicate setup_request_id test logic from generated client unit tests.
…t and improve docstring
8e31d83 to
20adea6
Compare
…vent coverage drop in showcase
20e4bea to
a8105ff
Compare
| request (Union[google.protobuf.message.Message, dict]): The request object. | ||
| field_name (str): The name of the field to populate. | ||
| is_proto3_optional (bool): Whether the field is proto3 optional. | ||
| """ |
There was a problem hiding this comment.
do we need the check below (similar to what we have in api-core)
if request is None:
return| from google.api_core.client_options import ClientOptions | ||
| from google.api_core import exceptions as core_exceptions | ||
| from google.api_core import gapic_v1 | ||
| {% if has_auto_populated_fields.value %} |
There was a problem hiding this comment.
Why do we only generate this file when has_auto_populated_fields is true?
| ) | ||
|
|
||
| self._client._setup_request_id(request, 'request_id', False) | ||
| setup_request_id(request, 'request_id', False) |
There was a problem hiding this comment.
doesn't this need to be imported?
…_core requests.py
4659080 to
e243bbd
Compare
cd6b66e to
e052b61
Compare
57a8810 to
6f07478
Compare
Updates generator templates and goldens to import public
requestsfromgoogle-api-coregapic_v1and callsetup_request_idhelper. Removes duplicatesetup_request_idtest logic from generated client unit tests.Temporarily pointing to this PR then will revert once it is merged/released: