gapic-generator-typescript icon indicating copy to clipboard operation
gapic-generator-typescript copied to clipboard

Compilation failure when generating functions v1 API

Open alexander-fenster opened this issue 4 years ago • 3 comments

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 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 --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_,
     });
   }

alexander-fenster avatar Jul 17 '20 20:07 alexander-fenster

@alexander-fenster didn't this one get addressed?

JustinBeckwith avatar Sep 02 '20 15:09 JustinBeckwith

@JustinBeckwith Not yet, but I'm on my way there (started with #682).

alexander-fenster avatar Sep 02 '20 18:09 alexander-fenster

Downgrading to feature request since it's just one API that is affected, and this API violates the recommendations of AIP-140.

alexander-fenster avatar Jan 28 '21 23:01 alexander-fenster