Skip to content

Commit 42ee4b9

Browse files
authored
feat: priorityRule 为 both 和 include 的时候都设置includeTags, includePaths 默认值为 [/.*/g] (#376)
* feat: priorityRule 为 both 和 include 的时候都设置includeTags * fix: 添加includePaths 默认值,解决没有设置includePaths时没有类型生成问题 * chore: generate changeset
1 parent fe22eaf commit 42ee4b9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.changeset/plain-yaks-warn.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+
priorityRule 为 both 和 include 的时候都设置includeTags, includePaths 的默认值为[/.*/g]

src/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ export async function generateService({
255255
mockFolder,
256256
includeTags,
257257
excludeTags,
258+
includePaths,
259+
excludePaths,
258260
authorization,
259261
isTranslateToEnglishTag,
260262
priorityRule = PriorityRule.include,
@@ -300,14 +302,28 @@ export async function generateService({
300302
? map(includeTags, (item) =>
301303
typeof item === 'string' ? item.toLowerCase() : item
302304
)
303-
: priorityRule === PriorityRule.include
305+
: priorityRule === PriorityRule.include ||
306+
priorityRule === PriorityRule.both
307+
? [/.*/g]
308+
: null,
309+
includePaths: includePaths
310+
? map(includePaths, (item) =>
311+
typeof item === 'string' ? item.toLowerCase() : item
312+
)
313+
: priorityRule === PriorityRule.include ||
314+
priorityRule === PriorityRule.both
304315
? [/.*/g]
305316
: null,
306317
excludeTags: excludeTags
307318
? map(excludeTags, (item) =>
308319
typeof item === 'string' ? item.toLowerCase() : item
309320
)
310321
: null,
322+
excludePaths: excludePaths
323+
? map(excludePaths, (item) =>
324+
typeof item === 'string' ? item.toLowerCase() : item
325+
)
326+
: null,
311327
requestOptionsType: '{[key: string]: unknown}',
312328
namespace: 'API',
313329
isGenReactQuery: false,

0 commit comments

Comments
 (0)