Skip to content

feat(generator): delegate REST transcoding to google-api-core#17766

Open
hebaalazzeh wants to merge 2 commits into
mainfrom
feat/gapic-generator-centralization-transcoding
Open

feat(generator): delegate REST transcoding to google-api-core#17766
hebaalazzeh wants to merge 2 commits into
mainfrom
feat/gapic-generator-centralization-transcoding

Conversation

@hebaalazzeh

Copy link
Copy Markdown
Contributor

this PR refactors generator templates to delegate REST transcoding to the centralized helper in google-api-core.

Scope of Changes:

  • _shared_macros.j2: Replaced inline static helper invocation with gapic_v1.rest_transcoding.transcode().
  • rest_base.py.j2: Stripped the redundant _get_transcoded_request, _get_request_body_json, and _get_query_params_json helper functions.
  • _rest_mixins_base.py.j2: Stripped the redundant static helpers from API REST mixins base.
  • rest.py.j2 & rest_asyncio.py.j2: Passed the configuration flags (like opts.rest_numeric_enums) into the transcoding macro.
  • noxfile.py: Configured local packages/google-api-core to be installed during virtualenv test generation so the new transcoding runtime module is available.

related PR: #17765

@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 refactors REST transcoding in the GAPIC generator by centralizing the transcoding logic into a new transcode function within google-api-core (gapic_v1.rest_transcoding). This change eliminates redundant static helper methods (_get_transcoded_request, _get_request_body_json, and _get_query_params_json) from the generated transport templates. Additionally, the PR updates test configurations and introduces comprehensive unit tests for the new transcoding utility. The feedback suggests optimizing the transcode function by using json_format.MessageToDict directly instead of the inefficient round-trip serialization of json.loads(json_format.MessageToJson(...)).

Comment thread packages/google-api-core/google/api_core/gapic_v1/rest_helpers.py Outdated
@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-generator-centralization-transcoding branch 3 times, most recently from b9bb9f0 to a8a1968 Compare July 18, 2026 06:02
@hebaalazzeh hebaalazzeh reopened this Jul 21, 2026
@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-generator-centralization-transcoding branch from 203e87a to 5e89b3d Compare July 21, 2026 16:31
@hebaalazzeh
hebaalazzeh marked this pull request as ready for review July 21, 2026 22:36
@hebaalazzeh
hebaalazzeh requested a review from a team as a code owner July 21, 2026 22:36
@snippet-bot

snippet-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Here is the summary of possible violations 😱

Details

There are 58 possible violations for not having product prefix.
There are format violations for 58 region tags.

The end of the violation section. All the stuff below is FYI purposes only.


Here is the summary of changes.

You are about to add 58 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-generator-centralization-transcoding branch from 909a6fe to dfca3e0 Compare July 21, 2026 23:12
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