Skip to content

feat(docs): Markdown 展示路由中间件 (issue #4) - #197

Merged
yourtion merged 7 commits into
mainfrom
feat/docs-middleware-show
Oct 27, 2026
Merged

yourtion merged 7 commits into
mainfrom
feat/docs-middleware-show

Conversation

@yourtion

@yourtion yourtion commented Jul 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #4

Markdown 按实际路由注册顺序展示具名中间件;同一个函数去重,无中间件、真正无名函数及 Function 构造器的 anonymous 名称省略输出。保留源码位置展示。

新增五项真实 builder 注册到文档 writer 的回归,包括具名顺序/去重、无中间件、数组内真正无名函数(明确断言 name 为空)、混合列表及有推断变量名的函数。修正原测试中 const anon = function() 实际会推断出名称的问题。

验证:615 个源码/覆盖率用例、构建、lint/格式检查通过。Swagger/Postman 的中间件输出保持原有行为。

基于修正后的 #218/#195/#196;按 #218 → #195 → #196 → #197 → #219 顺序合并。五包版本记录 3.2.6,最终统一发布 3.3.0,不发布中间版本。正式 CI 以最新 head 为准。

@codecov

codecov Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.86%. Comparing base (7fa51de) to head (70eb86b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #197   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files          28       28           
  Lines        2962     2982   +20     
  Branches      913      924   +11     
=======================================
+ Hits         2958     2978   +20     
  Misses          4        4           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yourtion
yourtion force-pushed the feat/docs-middleware-show branch from afaa71f to 62fd775 Compare July 9, 2026 05:20
getPathParams 此前只读 paramsSchema,与 getReqSendPath(看路径串)脱节。
当路由为 /:id 但未声明 params schema 时,生成路径引用了 id 变量,
函数签名却没有 id 参数 → 坏 SDK。

现在 getPathParams 在 paramsSchema 为空时从 realPath 的 :xxx 兜底提取,
保证签名与路径一致。已声明 paramsSchema 的场景行为不变。

- 新增 3 个回归测试(声明 params / 未声明 fallback / 无路径参数)
- bump 版本 3.2.1 → 3.2.3,登记 MIGRATION
sourceFile(relative/absolute)此前已在注册时采集,但未纳入 DOC_FIELD,
文档生成器拿不到。现加入 DOC_FIELD,并在 Markdown「请求地址」下方输出
「源码位置:<relative>」,便于从文档定位定义代码。无 sourceFile 时不输出。

- 新增 2 个回归测试(有/无 sourceFile)
- bump 版本 3.2.1 → 3.2.4,登记 MIGRATION
middlewares 此前已通过 .middlewares() 注册并经 DOC_FIELD 采集,
但四个生成器无一渲染。现 Markdown 在「请求地址」下方输出中间件函数名
列表(取具名函数 fn.name,匿名跳过)。Swagger/Postman 不受影响
(OpenAPI 标准无中间件字段)。

- 新增 3 个回归测试(具名中间件 / 无中间件 / 匿名跳过)
- bump 版本 3.2.1 → 3.2.5,登记 MIGRATION
@yourtion
yourtion force-pushed the feat/docs-middleware-show branch from 62fd775 to 70eb86b Compare October 27, 2026 02:39
@yourtion
yourtion merged commit a9bc7e3 into main Oct 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support middleware show in docs

1 participant