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

Đang mở Phù hợp với người mới
#4,064 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Đọc src/generator/templates/api-endpoint.njk và so sánh các biểu thức api.title và api.description với những trường mô tả khác có dùng cleanComments. Issue xác định hai chỗ còn thiếu áp dụng bộ lọc và các biểu thức dự kiến. Công việc hoàn tất khi cả hai trường được làm sạch nhất quán; hãy kiểm tra các bài kiểm thử của generator bao quát template này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
12.3k
Fork
2k
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleapis/google-api-nodejs-client

Tất cả issue của googleapis/google-api-nodejs-client

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.