Skip to content

Commit edaffe5

Browse files
author
李泽锴
committed
feat:operationId.replace(/[^a-zA-Z]+$/g, '') // 3. 移除尾部的非字母字符
1 parent 36b9a8f commit edaffe5

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

package.json

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "openapi-typescript-codegen",
3-
"version": "0.29.0",
2+
"name": "openapi-typescript-codegen-leyiya",
3+
"version": "0.33.0",
44
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
6-
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",
6+
"homepage": "https://github.com/a-leyi/openapi-typescript-codegen",
77
"repository": {
88
"type": "git",
9-
"url": "git+https://github.com/ferdikoomen/openapi-typescript-codegen.git"
9+
"url": "git+https://github.com/a-leyi/openapi-typescript-codegen.git"
1010
},
1111
"bugs": {
12-
"url": "https://github.com/ferdikoomen/openapi-typescript-codegen/issues"
12+
"url": "https://github.com/a-leyi/openapi-typescript-codegen/issues"
1313
},
1414
"license": "MIT",
1515
"keywords": [
@@ -55,7 +55,7 @@
5555
"test:e2e": "jest --selectProjects E2E --runInBand --verbose",
5656
"eslint": "eslint .",
5757
"eslint:fix": "eslint . --fix",
58-
"prepare": "npm run clean && npm run release",
58+
"prepare": "",
5959
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
6060
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
6161
},
@@ -67,17 +67,6 @@
6767
"handlebars": "^4.7.8"
6868
},
6969
"devDependencies": {
70-
"@angular-devkit/build-angular": "19.2.10",
71-
"@angular/animations": "17.3.3",
72-
"@angular/cli": "17.3.3",
73-
"@angular/common": "17.3.3",
74-
"@angular/compiler": "17.3.3",
75-
"@angular/compiler-cli": "17.3.3",
76-
"@angular/core": "17.3.3",
77-
"@angular/forms": "17.3.3",
78-
"@angular/platform-browser": "17.3.3",
79-
"@angular/platform-browser-dynamic": "17.3.3",
80-
"@angular/router": "17.3.3",
8170
"@babel/cli": "7.24.8",
8271
"@babel/core": "7.26.7",
8372
"@babel/preset-env": "7.26.0",

src/openApi/v3/parser/getOperationName.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const getOperationName = (url: string, method: string, operationId?: stri
1111
operationId
1212
.replace(/^[^a-zA-Z]+/g, '')
1313
.replace(/[^\w\-]+/g, '-')
14+
.replace(/[^a-zA-Z]+$/g, '') // 3. 移除尾部的非字母字符
1415
.trim()
1516
);
1617
}

src/utils/postProcessServiceOperations.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Service } from '../client/interfaces/Service';
33
import { flatMap } from './flatMap';
44

55
export const postProcessServiceOperations = (service: Service): Operation[] => {
6-
const names = new Map<string, number>();
6+
// const names = new Map<string, number>();
77

88
return service.operations.map(operation => {
99
const clone = { ...operation };
@@ -14,12 +14,12 @@ export const postProcessServiceOperations = (service: Service): Operation[] => {
1414
clone.imports.push(...flatMap(clone.results, result => result.imports));
1515

1616
// Check if the operation name is unique, if not then prefix this with a number
17-
const name = clone.name;
18-
const index = names.get(name) || 0;
19-
if (index > 0) {
20-
clone.name = `${name}${index}`;
21-
}
22-
names.set(name, index + 1);
17+
// const name = clone.name;
18+
// const index = names.get(name) || 0;
19+
// if (index > 0) {
20+
// clone.name = `${name}${index}`;
21+
// }
22+
// names.set(name, index + 1);
2323

2424
return clone;
2525
});

0 commit comments

Comments
 (0)