googleapis / googleapis/google-cloud-node
Refactor README.md.njk to avoid hardcoded documentation link for Storage Control
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
Pull request [PR googleapis/google-cloud-node-core#885](https://github.com/googleapis/google-cloud-node-core/pull/885) introduced a hardcoded special case for the `google-storage-control` library to fix its documentation link in the generated `README.md`.
### Reasoning
Hardcoding specific libraries in the generator templates (`api.naming.namePath == 'google-storage-control'`) is not a scalable or clean solution. It's likely that the generator is currently using a variable (`api.naming.nameNotCapitalized`) that doesn't accurately represent the documentation path for all products.
A better approach is to identify or introduce a variable in the `api` object that correctly represents the product's documentation slug (e.g., `storage-control` instead of `google-storage-control`) to ensure the links are generated correctly for all libraries without special casing.
### Relevant Files
- `generator/gapic-generator-typescript/templates/cjs/typescript_gapic/README.md.njk`
- `generator/gapic-generator-typescript/templates/esm/typescript_gapic/README.md.njk`
### Action Items
1. **Investigate Variables:** Analyze the `api` object structure used in the templates to find a more suitable variable for the documentation link (e.g., check other naming or product-related fields).
2. **Verify Solution:** Ensure the chosen variable works correctly for `google-storage-control` (yielding `storage-control`) and remains correct for other libraries.
3. **Remove Hardcoding:** Update the `README.md.njk` templates to use the correct variable universally and remove the `if/else` block introduced in PR googleapis/google-cloud-node-core#885.
Contributor guide
Assessment
This issue has not been assessed yet.