From 62d6913455d09e2fb406f4c44fa34509c1f0181f Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Thu, 3 Mar 2022 22:26:48 -0800 Subject: [PATCH] fix: should ignore google/rpc/context/*.proto (#1119) --- typescript/src/schema/api.ts | 1 + typescript/src/templater.ts | 2 -- typescript/test/unit/api.ts | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/typescript/src/schema/api.ts b/typescript/src/schema/api.ts index 26bf46431..e93ff3377 100644 --- a/typescript/src/schema/api.ts +++ b/typescript/src/schema/api.ts @@ -52,6 +52,7 @@ export class API { fd.package === 'google.protobuf' || fd.package === 'google.type' || fd.package === 'google.rpc' || + fd.package === 'google.rpc.context' || fd.package === 'google.api' ); } diff --git a/typescript/src/templater.ts b/typescript/src/templater.ts index 0790b3e8d..6b68bcabd 100644 --- a/typescript/src/templater.ts +++ b/typescript/src/templater.ts @@ -60,8 +60,6 @@ function createSnippetIndexMetadata( api: API, basePath: string ): protos.google.cloud.tools.snippetgen.snippetindex.v1.IIndex { - const apis: protos.google.cloud.tools.snippetgen.snippetindex.v1.IApi[] = []; - const clientLibrary: protos.google.cloud.tools.snippetgen.snippetindex.v1.IClientLibrary = { name: `nodejs-${api.naming.productName.toKebabCase()}`, version: '0.1.0', diff --git a/typescript/test/unit/api.ts b/typescript/test/unit/api.ts index f707aafe0..42898c2fe 100644 --- a/typescript/test/unit/api.ts +++ b/typescript/test/unit/api.ts @@ -113,7 +113,10 @@ describe('src/schema/api.ts', () => { const fd5 = new protos.google.protobuf.FileDescriptorProto(); fd5.name = 'google/api/servicemanagement/v1/servicemanager.proto'; fd5.package = 'google.api.servicemanager.v1'; - const api = new API([fd1, fd2, fd3, fd4, fd5], 'google', { + const fd6 = new protos.google.protobuf.FileDescriptorProto(); + fd6.name = 'google/rpc/context/attribute_context.proto'; + fd6.package = 'google.rpc.context'; + const api = new API([fd1, fd2, fd3, fd4, fd5, fd6], 'google', { grpcServiceConfig: new protos.grpc.service_config.ServiceConfig(), }); assert.deepStrictEqual(api.filesToGenerate, [