Skip to content

Refactor README.md.njk to avoid hardcoded documentation link for Storage Control #888

@quirogas

Description

@quirogas

Pull request PR #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 fix: update README templates to use correct API reference link for st… #885.

Metadata

Metadata

Assignees

No one assigned

    Labels

    size: sPull request size is small.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions