Skip to content

Commit d3e2734

Browse files
Merge pull request #539 from openapi-ui/main
chore: merge main to release
2 parents 395f534 + 3d7dbb8 commit d3e2734

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

.changeset/evil-houses-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openapi-ts-request': patch
3+
---
4+
5+
fix: fix bug #536

.changeset/poor-spoons-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openapi-ts-request': patch
3+
---
4+
5+
fix: fix cli comannd repeat

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ $ openapi --help
190190
-f, --full <boolean> full replacement (default: true)
191191
--enableLogging <boolean> open the log (default: false)
192192
--priorityRule <string> priority rule, include/exclude/both (default: "include")
193-
--filterCaseInsensitive <boolean> whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters
193+
--filterCaseInsensitive <boolean> whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters (default: false)
194194
--includeTags <(string|RegExp)[]> generate code from include tags
195195
--includePaths <(string|RegExp)[]> generate code from include paths
196196
--excludeTags <(string|RegExp)[]> generate code from exclude tags

openapi-ts-request.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { type GenerateServiceProps } from './src/index';
2+
13
export default [
24
{
35
schemaPath: 'http://petstore.swagger.io/v2/swagger.json',
46
serversPath: './apis/app',
57
},
6-
];
8+
] as GenerateServiceProps[];

src/bin/openapi.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ const params = program
2626
.option('-f, --full <boolean>', 'full replacement', true)
2727
.option('--enableLogging <boolean>', 'open the log', false)
2828
.option(
29-
'--filterCaseInsensitive <boolean>',
30-
'whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters',
31-
false
32-
)
33-
.option(
34-
'--includeTags <(string|RegExp)[]>',
35-
'generate code from include tags'
29+
'--priorityRule <string>',
30+
'priority rule, include/exclude/both (default: "include")'
3631
)
3732
.option(
3833
'--filterCaseInsensitive <boolean>',

src/generator/serviceGenarator.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,22 @@ export default class ServiceGenerator {
688688

689689
if (response?.isAnonymous) {
690690
const responseName = upperFirst(`${functionName}Response`);
691+
// 使用正则表达式移除 response?.type 中包含 this.config.namespace 的部分,isAnonymous模式不需要 this.config.namespace 前缀
692+
const cleanType = response?.type?.includes(
693+
`${this.config.namespace}.`
694+
)
695+
? response?.type?.replace(
696+
new RegExp(`${this.config.namespace}\\.`, 'g'),
697+
''
698+
)
699+
: response?.type || '';
691700
this.interfaceTPConfigs.push({
692701
typeName: responseName,
693-
type: response?.type,
702+
type: cleanType,
694703
isEnum: false,
695704
props: [],
696705
});
706+
697707
response.type = `${this.config.namespace}.${responseName}`;
698708
}
699709

0 commit comments

Comments
 (0)