diff --git a/packages/gapic-node-processing/src/get-bootstrap-template-vars.ts b/packages/gapic-node-processing/src/get-bootstrap-template-vars.ts index 72a9c1e6014..282e710c886 100644 --- a/packages/gapic-node-processing/src/get-bootstrap-template-vars.ts +++ b/packages/gapic-node-processing/src/get-bootstrap-template-vars.ts @@ -135,7 +135,7 @@ export function getServiceName(serviceConfig: ServiceConfig) { } export function getApiPath(apiId: string) { - return apiId.replace(/\.v.*/, '').replace(/\./g, '/'); + return apiId.replace(/\.v[0-9].*/, '').replace(/\./g, '/'); } export function getApiPathWithDashes(apiId: string) { diff --git a/packages/gapic-node-processing/test/get-bootstrap-template-vars.test.ts b/packages/gapic-node-processing/test/get-bootstrap-template-vars.test.ts index 7208dd891c0..a94128cea0a 100644 --- a/packages/gapic-node-processing/test/get-bootstrap-template-vars.test.ts +++ b/packages/gapic-node-processing/test/get-bootstrap-template-vars.test.ts @@ -42,18 +42,36 @@ const octokit = new Octokit({ describe('get bootstrap template vars', () => { describe('tests for metadata information', () => { - it('should return the API path without the version, with slashes', async () => { - assert.deepStrictEqual( - getApiPath('cloud.google.kms.v1'), - 'cloud/google/kms', - ); + describe('getApiPath', () => { + it('should return without the version, with slashes', async () => { + assert.deepStrictEqual( + getApiPath('cloud.google.kms.v1'), + 'cloud/google/kms', + ); + }); + + it('should preserve package names that start with v', async () => { + assert.deepStrictEqual( + getApiPath('cloud.google.visionai.v1'), + 'cloud/google/visionai', + ); + }); }); - it('should return the API path without the version, with dashes', async () => { - assert.deepStrictEqual( - getApiPathWithDashes('cloud.google.kms.v1'), - 'cloud-google-kms', - ); + describe('getApiPathWithDashes', () => { + it('should return without the version, with dashes', async () => { + assert.deepStrictEqual( + getApiPathWithDashes('cloud.google.kms.v1'), + 'cloud-google-kms', + ); + }); + + it('should preserve names that start with v', async () => { + assert.deepStrictEqual( + getApiPathWithDashes('cloud.google.visionai.v1'), + 'cloud-google-visionai', + ); + }); }); it('should get just the version', async () => {