googleapis / googleapis/google-cloud-node

Compilation failure when generating functions v1 API

Open
#7,797 3 comments 0 reactions 0 assignees View on GitHub
library: google-cloud-node-core priority: p2 type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

```sh
bazel build //google/cloud/functions/v1:functions-v1-nodejs
```

Compilation failure:
```
...
src/v1/cloud_functions_service_client.ts:1333:52 - error TS1138: Parameter declaration expected.

1333 cloudFunctionPath(project:string,location:string,function:string) {
~~~~~~~~
... (many more)
```

The API violates [AIP-140](https://google.aip.dev/140) by having a field named `function`. We can replace the known reserved words in the generated code. The following diff fixes the generated library:

```diff
diff --git a/src/v1/cloud_functions_service_client.ts.orig b/src/v1/cloud_functions_service_client.ts
index ba5d582..ce7bc85 100644
--- a/src/v1/cloud_functions_service_client.ts.orig
+++ b/src/v1/cloud_functions_service_client.ts
@@ -1330,11 +1330,11 @@ export class CloudFunctionsServiceClient {
* @param {string} function
* @returns {string} Resource name string.
*/
- cloudFunctionPath(project:string,location:string,function:string) {
+ cloudFunctionPath(project:string,location:string,function_:string) {
return this.pathTemplates.cloudFunctionPathTemplate.render({
project: project,
location: location,
- function: function,
+ function: function_,
});
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.