Skip to content

Commit e052b61

Browse files
committed
fix(generator): address remaining PR review comments
1 parent eb08c77 commit e052b61

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/gapic-generator
    • gapic/generator
    • tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1

packages/gapic-generator/gapic/generator/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _render_template(
266266
if not opts.metadata and template_name.endswith("gapic_metadata.json.j2"):
267267
return answer
268268

269-
# Only render _compat.py.j2 if the API schema has auto_populated_fields
269+
# Only render _compat.py.j2 if the API schema has auto_populated_fields (e.g. UUID4 request IDs) which require fallback functions
270270
if template_name.endswith("_compat.py.j2") or template_name.endswith("test__compat.py.j2"): # pragma: NO COVER
271271
has_auto_populated = any( # pragma: NO COVER
272272
m_settings and getattr(m_settings, "auto_populated_fields", None) # pragma: NO COVER

packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/_compat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
#
15+
"""A compatibility module for older versions of google-api-core."""
1616

1717
import uuid
1818

1919
try:
2020
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
2121
except ImportError:
22+
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove this fallback when google-api-core >= 2.26.0 is the minimum required version.
2223
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
2324
"""Populate a UUID4 field in the request if it is not already set.
2425

0 commit comments

Comments
 (0)