Skip to content

Commit

Permalink
feat: 通过 ytt init 初始化的配置文件中的 getRequestFunctionName 默认改为「以接口全路径生成请求函数…
Browse files Browse the repository at this point in the history
…名」并备注遇到请求函数名是语法关键词报错、重复时的解决方案
  • Loading branch information
fjc0k committed Dec 21, 2021
1 parent 5d2e9c7 commit 1aefd41
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 207 deletions.
11 changes: 8 additions & 3 deletions src/cli.ts
Expand Up @@ -131,9 +131,14 @@ export async function run(
{
id: 0,
getRequestFunctionName(interfaceInfo, changeCase) {
return changeCase.camelCase(
interfaceInfo.parsedPath.name,
)
// 以接口全路径生成请求函数名
return changeCase.camelCase(interfaceInfo.path)
// 若生成的请求函数名存在语法关键词报错、或想通过某个关键词触发 IDE 自动引入提示,可考虑加前缀,如:
// return changeCase.camelCase(\`api_\${interfaceInfo.path}\`)
// 若生成的请求函数名有重复报错,可考虑将接口请求方式纳入生成条件,如:
// return changeCase.camelCase(\`\${interfaceInfo.method}_\${interfaceInfo.path}\`)
},
},
],
Expand Down

0 comments on commit 1aefd41

Please sign in to comment.