Skip to content

fix: rename variable in generated test methods to avoid field name collision#1286

Open
aandreassa wants to merge 1 commit into
mainfrom
client-rename
Open

fix: rename variable in generated test methods to avoid field name collision#1286
aandreassa wants to merge 1 commit into
mainfrom
client-rename

Conversation

@aandreassa
Copy link
Copy Markdown
Contributor

@aandreassa aandreassa commented May 13, 2026

Renames the local client variable (used when instantiating the service client under test) to client_stub across all gRPC and REST test templates.

This prevents variable shadowing and collisions with existing names.

This fixes a generation error in google-cloud-run-v2 where the gem introduces a field named client in SubmitBuildRequest.

Failed generation PR: googleapis/google-cloud-ruby#32252

…llision

Renames the local `client` variable (used when instantiating the service client under test) to `client_stub` across all gRPC and REST test templates.

This prevents collisions with existing names.

This fixes a generation error in google-cloud-run-v2 where the gem defines a field named `client` in `SubmitBuildRequest`.

https://github.com/googleapis/googleapis/blob/a0cedfb6af9305b49db07dccaa7d0c8985e07e70/google/cloud/run/v2/build.proto#L143
@aandreassa aandreassa changed the title fix: rename local variable in generated test methods to avoid field … fix: rename variable in generated test methods to avoid field name collision May 13, 2026
@aandreassa aandreassa marked this pull request as ready for review May 13, 2026 17:54
@aandreassa aandreassa requested a review from a team as a code owner May 13, 2026 17:54
Copy link
Copy Markdown
Member

@quartzmo quartzmo left a comment

Choose a reason for hiding this comment

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

Do you think it's too risky to name this variable c instead of client_stub?

It would save 10 characters!

@quartzmo
Copy link
Copy Markdown
Member

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.

2 participants