You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To completely remove the generation and maintenance of snippet_metadata_*.json files across the Node.js client libraries, as these files are no longer actively use (seee go/snippet-gen-design).
The generator is the source of these files. We should stop it from emitting them entirely.
Modify templater.ts:
Remove the if (outputFilename.match(/snippet_metadata/)) block in processOneTemplate(). This block currently bypasses standard template rendering to manually construct the JSON metadata.
Remove the createSnippetIndexMetadata() and createSnippetMetadata() helper functions.
Remove the countRegionTagLines() and findRegionTag() helpers if they are not used elsewhere.
Librarian currently contains post-processing logic to update the hardcoded 0.1.0 version in these files.
Modify internal/librarian/nodejs/generate.go:
Remove the call to updateSnippetMetadataVersion().
Delete the updateSnippetMetadataVersion() function and its related types (snippetMetadata, clientLibrary).
Cleanup v1small Workarounds:
The v1small skip in updateSnippetMetadataVersion() can be removed once the function is deleted.
3. Cleanup PR (Monorepo-wide)
Once generation is disabled, we should perform one final sweep of the monorepo to delete all existing snippet_metadata_*.json files to avoid having orphaned files.
Implementation Path
Submit PR to google-cloud-node (or gapic-generator-typescript repo) to disable generation.
Submit PR to librarian to remove the version-updating post-processor.
Execute a monorepo-wide deletion PR (similar to Task 5.3) for all modern UNDERSCORE metadata files.
Benefits
Reduced Diff Noise: Eliminates a large source of churn (version bumps and line shifts) in every generation PR.
Faster Generation: Skips the expensive template scanning and region tag counting logic in the generator.
Cleaner Pipeline: Removes complex post-processing logic from Librarian.
To completely remove the generation and maintenance of
snippet_metadata_*.jsonfiles across the Node.js client libraries, as these files are no longer actively use (seee go/snippet-gen-design).Proposed Changes
1. TypeScript Generator (
gapic-generator-typescript)The generator is the source of these files. We should stop it from emitting them entirely.
templater.ts:if (outputFilename.match(/snippet_metadata/))block inprocessOneTemplate(). This block currently bypasses standard template rendering to manually construct the JSON metadata.createSnippetIndexMetadata()andcreateSnippetMetadata()helper functions.countRegionTagLines()andfindRegionTag()helpers if they are not used elsewhere.templates/esm/typescript_samples/samples/generated/$version/snippet_metadata_$apiNamingProtoPackage.json.njk.templates/cjs/typescript_samples/samples/generated/$version/snippet_metadata_$apiNamingProtoPackage.json.njk.2. Librarian (
googleapis/librarian)Librarian currently contains post-processing logic to update the hardcoded
0.1.0version in these files.internal/librarian/nodejs/generate.go:updateSnippetMetadataVersion().updateSnippetMetadataVersion()function and its related types (snippetMetadata,clientLibrary).v1smallWorkarounds:v1smallskip inupdateSnippetMetadataVersion()can be removed once the function is deleted.3. Cleanup PR (Monorepo-wide)
Once generation is disabled, we should perform one final sweep of the monorepo to delete all existing
snippet_metadata_*.jsonfiles to avoid having orphaned files.Implementation Path
google-cloud-node(orgapic-generator-typescriptrepo) to disable generation.librarianto remove the version-updating post-processor.Benefits
0.1.0Snippet Metadata Version Leakage synthtool#2173