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

未关闭 适合新手
#4,064 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

阅读 src/generator/templates/api-endpoint.njk,并将表达式 api.title 和 api.description 与其他使用 cleanComments 的描述字段进行比较。Issue 指明了缺少的两处过滤器应用以及预期的表达式。两个字段都得到一致的清理后,任务即完成;检查覆盖此模板的生成器测试。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
12.3k
派生
2k
平均合并
3 天 10 小时
30 天内合并 PR
9

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/google-api-nodejs-client 的其他 Issue

查看 googleapis/google-api-nodejs-client 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。