fix(axios-sdk): 路径参数兜底提取 (issue #27)#195
Open
yourtion wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #195 +/- ##
=======================================
Coverage 92.54% 92.55%
=======================================
Files 28 28
Lines 2939 2942 +3
Branches 770 772 +2
=======================================
+ Hits 2720 2723 +3
Misses 217 217
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
0612939 to
341cffd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 issue
Closes #27
问题
generate_axios的getPathParams只读paramsSchema,而getReqSendPath只看路径串,两者脱节。当路由为/:id但用户未声明params schema时,生成的请求路径引用了变量id,函数签名却没有id参数 → 生成引用未定义变量的坏 SDK。修复
getPathParams在paramsSchema为空时,从realPath的:xxx兜底提取参数名,保证签名与路径一致。已声明paramsSchema的场景行为不变。测试
npm run test:lib:317 → 320 全绿tsc --noEmit通过版本
bump 3.2.1 → 3.2.3,已登记 MIGRATION
合并顺序提示
本系列共 4 个 PR,请按版本号顺序合并(3.2.2 → 3.2.3 → 3.2.4 → 3.2.5)。
⚠️ 合并时
MIGRATION.md与package.json可能与已合并的 PR 冲突,需在合并时 rebase 解冲突(保留双方版本号递增)。