fix: add logic to check for IAM RPC methods within the service before adding mixin to avoid generating duplicate methods#906
Conversation
… adding mixin to avoid generating duplicate methods
generator/gapic-generator-typescript/typescript/src/generator.ts
Outdated
Show resolved
Hide resolved
generator/gapic-generator-typescript/typescript/src/generator.ts
Outdated
Show resolved
Hide resolved
sofisl
left a comment
There was a problem hiding this comment.
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!
…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.
|
@shivanee-p closing this for the migration, feel free to reopen in google-cloud-node when we migrate over! |
add logic to check for IAM RPC methods within the service before adding mixin to avoid generating duplicate methods
Fixes #905 🦕