Skip to content

Commit

Permalink
Merge pull request #67 from long-woo/fix/action_name
Browse files Browse the repository at this point in the history
v1.6.2
  • Loading branch information
long-woo committed Aug 21, 2024
2 parents 2dc7a48 + ca20b4e commit 59761ad
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@
},
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[json]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[jsonc]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[jsonl]": {
"editor.defaultFormatter": "denoland.vscode-deno"
}
}
7 changes: 3 additions & 4 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@loongwoo/stc",
"version": "1.6.1",
"version": "1.6.2",
"exports": "./mod.ts",
"tasks": {
"dev": "deno run -A --watch=src src/main.ts --url 'https://petstore3.swagger.io/api/v3/openapi.json'",
"serve": "deno run -A --watch=src src/service.ts",
"version": "echo '1.6.1' > release/version",
"version": "echo '1.6.2' > release/version",
"build:npm": "deno run -A src/npm/index.ts",
"build:mac": "deno compile -A --target x86_64-apple-darwin --output release/stc src/main.ts",
"build:mac-m": "deno compile -A --target aarch64-apple-darwin --output release/stc-m src/main.ts",
Expand Down Expand Up @@ -33,8 +33,7 @@
],
"exclude": [
"out/**/*",
"dist",
"**/npm/package.json"
"dist"
]
},
"test": {
Expand Down
29 changes: 29 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ i18next.init({
translation: zhCNTranslation,
},
},
interpolation: {
escapeValue: false,
},
});

const i18n = (lng?: string) => i18next.getFixedT(lng || locale);
Expand Down
2 changes: 1 addition & 1 deletion src/npm/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as dnt from "x/dnt@0.40.0/mod.ts";
// import * as esbuild from "x/esbuild@v0.18.6/mod.js";
import pkg from "./package.json" with { type: "json" };
import pkg from "./pkg.json" with { type: "json" };

// const res = await esbuild.build({
// entryPoints: ["./src/cli.ts"],
Expand Down
4 changes: 2 additions & 2 deletions src/npm/package.json → src/npm/pkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@loongwoo/stc",
"version": "1.6.1",
"version": "1.6.2",
"description": "OpenApi/Swagger/Apifox document conversion tool.\nOpenAPI(Swagger)、Apifox 文档转换为接口文件。",
"type": "module",
"module": "esm/mod.js",
Expand Down Expand Up @@ -44,4 +44,4 @@
}
}
}
}
}
9 changes: 7 additions & 2 deletions src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ export const getApiPath = (
return;
}

// 添加请求方式标识,如 GET,POST 等,防止重名。
if (!name.toLowerCase().includes(method)) {
// 添加请求方式标识,如 GET,POST 等,防止重名。设置了 operationId,以 operationId 为准
if (
!currentMethod.operationId &&
!/^(get|post|put|delete|options|head|patch)$/i.test(
name.slice(0, method.length),
)
) {
name = `${method}${upperCase(name)}`;
}

Expand Down

0 comments on commit 59761ad

Please sign in to comment.