fix: cleanComments filter not applied to api.title and api.description in api-endpoint.njk

Open Beginner friendly
#4,064 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript

Research direction

Read src/generator/templates/api-endpoint.njk and compare the api.title and api.description expressions with the other description fields that use cleanComments. The issue identifies the two missing filter applications and the intended expressions. Done means both fields are sanitized consistently; check the generator tests that cover this template.

Written by the indexing model from the issue text.

Description

Summary

The cleanComments filter in filters.ts (lines 85–93) neutralises */ and /*
to prevent them from escaping JSDoc block comments in generated TypeScript. It is
applied to every method, parameter, and schema description field in
api-endpoint.njk, but is missing from api.title and api.description
at lines 58 and 60.

Expected behaviour

api.title and api.description are sanitised with cleanComments, consistent
with every other description field in the same template.

Actual behaviour

Both fields are rendered raw. The filter already exists and already handles this
case, it is simply not applied to these two fields.

Proposed fix

Two-line change in src/generator/templates/api-endpoint.njk:

Line 58
Before: * {{ api.title }}
After: * {{ api.title | cleanComments | safe }}

Line 60
Before: * {{ api.description | replace("\n", "\n * ") }}
After: * {{ api.description | cleanComments | safe | replace("\n", "\n * ") }}

I'm happy to submit a PR if the fix looks good.

Dominant language
TypeScript
Stars
12.3k
Forks
2k
Avg merge
3d 10h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/google-api-nodejs-client

All issues in googleapis/google-api-nodejs-client

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.