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 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
node.js, typescript

研究方向

閱讀 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 摘要。