Skip to content

feat(gapic-generator): add rpc_name metadata to mixin schema definitions - #18516

Merged
chalmerlowe merged 1 commit into
mainfrom
feat/gapic-mixin-rpc-names
Sep 30, 2026
Merged

chalmerlowe merged 1 commit into
mainfrom
feat/gapic-mixin-rpc-names

Conversation

@chalmerlowe

@chalmerlowe chalmerlowe commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

GAPIC generator schema models define mixin methods (MixinMethod) with request types, response types, and method names, but do not provide the canonical full gRPC RPC name (for example, google.longrunning.Operations/GetOperation). When generating telemetry, method span names, or interceptor routing for mixins, downstream templates lack a clean attribute for the full RPC name.

Solution

  • Add an rpc_name attribute (defaulting to empty string) to the MixinMethod dataclass in gapic/schema/wrappers.py.
  • Populate canonical RPC names across all standard mixin definitions in gapic/schema/mixins.py (google.longrunning.Operations/*, google.iam.v1.IAMPolicy/*, and google.cloud.location.Locations/*).
  • Add assertions in tests/unit/schema/test_api.py validating that mixin schema signatures contain the expected RPC names.

Notes for Reviewers

  • This change is strictly additive to the generator's internal schema metadata.
  • It produces no golden diffs and has no side effects on existing generated client libraries.

@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 introduces an rpc_name field to the MixinMethod class in wrappers.py and populates it for various mixin methods in mixins.py. It also updates the unit tests in test_api.py to assert the correct assignment of these RPC names. Additionally, the changes include import reorganization and minor code formatting improvements across the modified files. There are no review comments to address.

api_schema = api.API.build(fd, "google.example.v1", opts=opts)
res = api_schema.mixin_api_signatures
assert res == mixins.MIXINS_MAP
assert res["GetOperation"].rpc_name == "google.longrunning.Operations/GetOperation"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These are the only logic changes to this file.
Everything else should be simply ruff reformating.

name: str
request_type: str
response_type: str
rpc_name: str = ""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the only logic changes to this file.
Everything else should be simply ruff reformating.

@chalmerlowe chalmerlowe self-assigned this Sep 30, 2026
@chalmerlowe chalmerlowe added the automerge Merge the pull request once unit tests and other checks pass. label Sep 30, 2026
@chalmerlowe
chalmerlowe marked this pull request as ready for review September 30, 2026 19:37
@chalmerlowe
chalmerlowe requested a review from a team as a code owner September 30, 2026 19:37
@chalmerlowe
chalmerlowe merged commit fc1b469 into main Sep 30, 2026
117 checks passed
@chalmerlowe
chalmerlowe deleted the feat/gapic-mixin-rpc-names branch September 30, 2026 20:01
@release-please release-please Bot mentioned this pull request Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Merge the pull request once unit tests and other checks pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants