Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename unary LRO for diregapic #956

Closed
wants to merge 1 commit into from

Conversation

summer-ji-eng
Copy link
Collaborator

Rename DIREGAPIC LRO for forward compatibility at GA

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 17, 2021
@@ -24,11 +24,11 @@
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"Delete": {
"UnaryDelete": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we must keep the original method names in this config because this is only a client change and gax will keep using original names.

@@ -206,7 +206,7 @@ export class AddressesClient {
// Iterate over each of the methods that the service provides
// and create an API call method for each.
const addressesStubMethods =
['aggregatedList', 'delete', 'insert', 'list'];
['aggregatedList', 'unaryDelete', 'unaryInsert', 'list'];
Copy link
Contributor

Choose a reason for hiding this comment

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

We must not rename the names in the stubs. The stub still has original names taken from the protos.

@@ -369,23 +369,23 @@ export class AddressesClient {
'project': request.project || '',
});
this.initialize();
return this.innerApiCalls.delete(request, options, callback);
return this.innerApiCalls.unaryDelete(request, options, callback);
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, let's keep innerApiCalls name just delete. We only want to rename the user-visible method, without touching any internals.

@@ -438,6 +458,11 @@ function augmentMethod(
);
}
}
// Rename the unary LRO method
if (isUnaryLRO(parameters.service, method, parameters.diregapic)) {
method.name = 'Unary' + method.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the right approach. The generator code must not know anything about the TypeScript specific. The renames must be done in the templates, there is a Namer functionality there to avoid naming conflicts.

See how we build the names for paginated Async function as an example.

@vchudnov-g
Copy link

Thanks for doing this! Two notes:

  • let's not merge this until we have agreement that providing the unary methods (as opposed to, say, just doing the full implementation outright) is what we want to do
  • if we do decide to go with this approach, it would be good for the name modification to be as consistent as possible across languages. See the internal doc for the possibilities we're considering. I'm guessing it will be a suffix, not a prefix, and something other than "Unary"

@summer-ji-eng
Copy link
Collaborator Author

Another approach on #967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants