Skip to content

fix: add logic to check for IAM RPC methods within the service before adding mixin to avoid generating duplicate methods#906

Draft
shivanee-p wants to merge 13 commits intomainfrom
shivaneep-update-generator-logic-IAM-mixin
Draft

fix: add logic to check for IAM RPC methods within the service before adding mixin to avoid generating duplicate methods#906
shivanee-p wants to merge 13 commits intomainfrom
shivaneep-update-generator-logic-IAM-mixin

Conversation

@shivanee-p
Copy link
Contributor

add logic to check for IAM RPC methods within the service before adding mixin to avoid generating duplicate methods

Fixes #905 🦕

… adding mixin to avoid generating duplicate methods
@shivanee-p shivanee-p requested a review from a team as a code owner February 23, 2026 23:32
Copy link
Contributor

@sofisl sofisl left a comment

Choose a reason for hiding this comment

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

I think you're on the right track, but I think you want to create a new function that sets the mixins to 0 in augmentService if they already exist in the protos. take a look at what getSelectiveGapic does - it's kind of similar to what we want to do. I basically think we want to do something like, if there are the mixin methods already in the service's methods, then we want to set the mixin to 0 (kind of similar to the logic in lines 1063 - 1072).

Another idea is to talk to other languages to see what logic they use. I'd assume we're just doing some regex checking (i.e., if methods have 'iam' or "locations', then don't set the mixin), but I'm not sure - worth checking!

@shivanee-p shivanee-p marked this pull request as draft March 10, 2026 23:23
shivanee-p and others added 10 commits March 11, 2026 15:46
…check for method name conflicts with the IAM and Location mixins before generating the methods. This is to avoid generating duplicate methods in cases where the service already has methods with the same names as those provided by the mixins.

Based on https://google.aip.dev/client-libraries/4234#overriding-a-duplicate-rpc, some mixin methods may be defined within the service file, but not necessarily all. The generator will silently skip the duplicate mixin methods for the IAM and Location mixins.
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.

Generator: give precendence to protos if mixin is declared

2 participants