diff --git a/.changeset/few-elephants-sit.md b/.changeset/few-elephants-sit.md new file mode 100644 index 0000000..622750d --- /dev/null +++ b/.changeset/few-elephants-sit.md @@ -0,0 +1,5 @@ +--- +"openapi-ts-request": minor +--- + +feat: 过滤条件默认大小写敏感,提供参数filterCaseInsensitive支持,关闭 #467 diff --git a/README-en_US.md b/README-en_US.md index fb03aed..d43010c 100644 --- a/README-en_US.md +++ b/README-en_US.md @@ -192,6 +192,7 @@ $ openapi --help -f, --full full replacement (default: true) --enableLogging open the log (default: false) --priorityRule priority rule, include/exclude/both (default: "include") + --filterCaseInsensitive whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters. (default: false) --includeTags <(string|RegExp)[]> generate code from include tags --includePaths <(string|RegExp)[]> generate code from include paths --excludeTags <(string|RegExp)[]> generate code from exclude tags @@ -230,6 +231,7 @@ openapi -i ./spec.json -o ./apis | full | no | boolean | true | full replacement | | enableLogging | no | boolean | false | open the log | | priorityRule | no | string | 'include' | priority rule, include/exclude/both | +| filterCaseInsensitive | no | boolean | false | whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters. (default: false) | | | includeTags | no | (string\|RegExp)[] | - | generate code from include tags, priorityRule=include required | | includePaths | no | (string\|RegExp)[] | - | generate code from include paths | | excludeTags | no | (string\|RegExp)[] | - | generate code from exclude tags | diff --git a/README.md b/README.md index 20e59eb..aff372a 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ $ openapi --help -f, --full full replacement (default: true) --enableLogging open the log (default: false) --priorityRule priority rule, include/exclude/both (default: "include") + --filterCaseInsensitive whether to perform a case-insensitive match with includeTags, includePaths, excludeTags, excludePaths filters. (default: false) --includeTags <(string|RegExp)[]> generate code from include tags --includePaths <(string|RegExp)[]> generate code from include paths --excludeTags <(string|RegExp)[]> generate code from exclude tags @@ -232,6 +233,7 @@ openapi --i ./spec.json --o ./apis | full | 否 | boolean | true | 是否全量替换 | | enableLogging | 否 | boolean | false | 是否开启日志 | | priorityRule | 否 | string | 'include' | 模式规则,可选include/exclude/both | +| filterCaseInsensitive | 否 | boolean | false | 执行 includeTags、includePaths、excludeTags、excludePaths 过滤时是否忽略大小写 | | | includeTags | 否 | (string\|RegExp)[] | - | 根据指定的 tags 生成代码, priorityRule=include则必填 | | includePaths | 否 | (string\|RegExp)[] | - | 根据指定的 paths 生成代码 | | excludeTags | 否 | (string\|RegExp)[] | - | 根据指定的 tags 不生成代码 | diff --git a/src/generator/serviceGenarator.ts b/src/generator/serviceGenarator.ts index 8ed931e..27efd55 100644 --- a/src/generator/serviceGenarator.ts +++ b/src/generator/serviceGenarator.ts @@ -202,8 +202,6 @@ export default class ServiceGenerator { return; } - const tagLowerCase = tag.toLowerCase(); - if (priorityRule === PriorityRule.include) { // includeTags 为空,不会匹配任何path,故跳过 if (isEmpty(includeTags)) { @@ -211,13 +209,13 @@ export default class ServiceGenerator { return; } - if (!this.validateRegexp(tagLowerCase, includeTags)) { + if (!this.validateRegexp(tag, includeTags)) { return; } } if (priorityRule === PriorityRule.exclude) { - if (this.validateRegexp(tagLowerCase, excludeTags)) { + if (this.validateRegexp(tag, excludeTags)) { return; } } @@ -230,11 +228,9 @@ export default class ServiceGenerator { } const outIncludeTags = - !isEmpty(includeTags) && - !this.validateRegexp(tagLowerCase, includeTags); + !isEmpty(includeTags) && !this.validateRegexp(tag, includeTags); const inExcludeTags = - !isEmpty(excludeTags) && - this.validateRegexp(tagLowerCase, excludeTags); + !isEmpty(excludeTags) && this.validateRegexp(tag, excludeTags); if (outIncludeTags || inExcludeTags) { return; @@ -491,12 +487,7 @@ export default class ServiceGenerator { } const flag = this.validateRegexp( - filter( - map(tags, (tag) => - tag?.toLowerCase ? tag.toLowerCase() : undefined - ), - (tag) => !!tag - ), + filter(tags, (tag) => !!tag), includeTags ); @@ -1561,7 +1552,9 @@ export default class ServiceGenerator { // 提取匹配逻辑到单独的函数 private matches(item: string, reg: string | RegExp): boolean { if (typeof reg === 'string') { - return minimatch(item, reg); + return minimatch(item, reg, { + nocase: this.config.filterCaseInsensitive, + }); } else if (reg instanceof RegExp) { reg.lastIndex = 0; // 重置正则表达式的 lastIndex 属性 diff --git a/src/index.ts b/src/index.ts index 622d5b0..f202783 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,6 +53,11 @@ export type GenerateServiceProps = { * 优先规则, include(只允许include列表) | exclude(只排除exclude列表) | both(允许include列表,排除exclude列表) */ priorityRule?: IPriorityRule; + + /** + * includeTags、includePaths、excludeTags、excludePaths 过滤器执行时是否忽略大小写 + */ + filterCaseInsensitive?: boolean; /** * 只解析归属于 tags 集合的 api 和 schema */ @@ -319,9 +324,7 @@ export async function generateService({ enableLogging: false, priorityRule, includeTags: includeTags - ? map(includeTags, (item) => - isString(item) ? item.toLowerCase() : item - ) + ? includeTags : priorityRule === PriorityRule.include || priorityRule === PriorityRule.both ? [/.*/g] @@ -332,11 +335,7 @@ export async function generateService({ priorityRule === PriorityRule.both ? [/.*/g] : null, - excludeTags: excludeTags - ? map(excludeTags, (item) => - isString(item) ? item.toLowerCase() : item - ) - : null, + excludeTags: excludeTags ? excludeTags : null, excludePaths: excludePaths ? excludePaths : null, requestOptionsType: '{[key: string]: unknown}', namespace: 'API', diff --git a/test/__snapshots__/exclude/should excludePaths can be case insensitive.snap b/test/__snapshots__/exclude/should excludePaths can be case insensitive.snap new file mode 100644 index 0000000..d7a0a89 --- /dev/null +++ b/test/__snapshots__/exclude/should excludePaths can be case insensitive.snap @@ -0,0 +1,498 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userZ'; +export * from './userY'; +export * from './userX'; +export * from './sysC'; +export * from './sysB'; +export * from './sysA'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** a1 GET /sys-a/a1 */ +export async function sysAa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/aa1 GET /sys-a/a1/aa1 */ +export async function sysAa1Aa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** b1 GET /sys-b/b1 */ +export async function sysBb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1 GET /sys-b/b1/bb1 */ +export async function sysBb1Bb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1 GET /sys-b/b1/bb1/bbb1 */ +export async function sysBb1Bb1Bbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1/bbbb1 GET /sys-b/b1/bb1/bbb1/bbbb1 */ +export async function sysBb1Bb1Bbb1Bbbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1/bbbb1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** c1 GET /sys-c/c1 */ +export async function sysCc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1 GET /sys-c/c1/cc1 */ +export async function sysCc1Cc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1 GET /sys-c/c1/cc1/ccc1 */ +export async function sysCc1Cc1Ccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1/cccc1 GET /sys-c/c1/cc1/ccc1/cccc1 */ +export async function sysCc1Cc1Ccc1Cccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1/cccc1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysAa1Aa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1Bbbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1Cccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1Xxxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1Yyyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1Zzzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** x1 GET /user-x/x1 */ +export async function userXx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1 GET /user-x/x1/xx1 */ +export async function userXx1Xx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1 GET /user-x/x1/xx1/xxx1 */ +export async function userXx1Xx1Xxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1/xxxx1 GET /user-x/x1/xx1/xxx1/xxxx1 */ +export async function userXx1Xx1Xxx1Xxxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1/xxxx1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** y1 GET /user-y/y1 */ +export async function userYy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1 GET /user-y/y1/yy1 */ +export async function userYy1Yy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1 GET /user-y/y1/yy1/yyy1 */ +export async function userYy1Yy1Yyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1 GET /user-y/y1/yy1/yyy1/yyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1/yyyyy1 GET /user-y/y1/yy1/yyy1/yyyy1/yyyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1Yyyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1/yyyyy1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** f1 ffff GET /user-z/z1 */ +export async function userZz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1 GET /user-z/z1/zz1 */ +export async function userZz1Zz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1 GET /user-z/z1/zz1/zzz1 */ +export async function userZz1Zz1Zzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1 GET /user-z/z1/zz1/zzz1/zzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1/zzzzz1 GET /user-z/z1/zz1/zzz1/zzzz1/zzzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1Zzzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1/zzzzz1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/__snapshots__/exclude/should excludePaths case sensitive by default.snap b/test/__snapshots__/exclude/should excludePaths case sensitive by default.snap new file mode 100644 index 0000000..794fa6b --- /dev/null +++ b/test/__snapshots__/exclude/should excludePaths case sensitive by default.snap @@ -0,0 +1,536 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userZ'; +export * from './userY'; +export * from './userX'; +export * from './sysC'; +export * from './sysB'; +export * from './sysA'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** a1 GET /sys-a/a1 */ +export async function sysAa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/aa1 GET /sys-a/a1/aa1 */ +export async function sysAa1Aa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1 GET /sys-a/a1/aa1/aaa1 */ +export async function sysAa1Aa1Aaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1/aaa1 GET /sys-a/a1/aa1/aaa1/aaaa1 */ +export async function sysAa1Aa1Aaa1Aaaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1/aaaa1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** b1 GET /sys-b/b1 */ +export async function sysBb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1 GET /sys-b/b1/bb1 */ +export async function sysBb1Bb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1 GET /sys-b/b1/bb1/bbb1 */ +export async function sysBb1Bb1Bbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1/bbbb1 GET /sys-b/b1/bb1/bbb1/bbbb1 */ +export async function sysBb1Bb1Bbb1Bbbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1/bbbb1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** c1 GET /sys-c/c1 */ +export async function sysCc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1 GET /sys-c/c1/cc1 */ +export async function sysCc1Cc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1 GET /sys-c/c1/cc1/ccc1 */ +export async function sysCc1Cc1Ccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1/cccc1 GET /sys-c/c1/cc1/ccc1/cccc1 */ +export async function sysCc1Cc1Ccc1Cccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1/cccc1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysAa1Aa1Aaa1Aaaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1Aaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1Bbbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1Cccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1Xxxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1Yyyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1Zzzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** x1 GET /user-x/x1 */ +export async function userXx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1 GET /user-x/x1/xx1 */ +export async function userXx1Xx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1 GET /user-x/x1/xx1/xxx1 */ +export async function userXx1Xx1Xxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1/xxxx1 GET /user-x/x1/xx1/xxx1/xxxx1 */ +export async function userXx1Xx1Xxx1Xxxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1/xxxx1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** y1 GET /user-y/y1 */ +export async function userYy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1 GET /user-y/y1/yy1 */ +export async function userYy1Yy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1 GET /user-y/y1/yy1/yyy1 */ +export async function userYy1Yy1Yyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1 GET /user-y/y1/yy1/yyy1/yyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1/yyyyy1 GET /user-y/y1/yy1/yyy1/yyyy1/yyyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1Yyyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1/yyyyy1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** f1 ffff GET /user-z/z1 */ +export async function userZz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1 GET /user-z/z1/zz1 */ +export async function userZz1Zz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1 GET /user-z/z1/zz1/zzz1 */ +export async function userZz1Zz1Zzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1 GET /user-z/z1/zz1/zzz1/zzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1/zzzzz1 GET /user-z/z1/zz1/zzz1/zzzz1/zzzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1Zzzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1/zzzzz1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/__snapshots__/exclude/should excludeTags can be case insensitive.snap b/test/__snapshots__/exclude/should excludeTags can be case insensitive.snap new file mode 100644 index 0000000..cf67af4 --- /dev/null +++ b/test/__snapshots__/exclude/should excludeTags can be case insensitive.snap @@ -0,0 +1,353 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userY'; +export * from './userX'; +export * from './sysC'; +export * from './sysB'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** b1 GET /sys-b/b1 */ +export async function sysBb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1 GET /sys-b/b1/bb1 */ +export async function sysBb1Bb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1 GET /sys-b/b1/bb1/bbb1 */ +export async function sysBb1Bb1Bbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1/bbbb1 GET /sys-b/b1/bb1/bbb1/bbbb1 */ +export async function sysBb1Bb1Bbb1Bbbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1/bbbb1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** c1 GET /sys-c/c1 */ +export async function sysCc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1 GET /sys-c/c1/cc1 */ +export async function sysCc1Cc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1 GET /sys-c/c1/cc1/ccc1 */ +export async function sysCc1Cc1Ccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1/cccc1 GET /sys-c/c1/cc1/ccc1/cccc1 */ +export async function sysCc1Cc1Ccc1Cccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1/cccc1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysBb1Bb1Bbb1Bbbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1Cccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1Xxxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1Yyyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** x1 GET /user-x/x1 */ +export async function userXx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1 GET /user-x/x1/xx1 */ +export async function userXx1Xx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1 GET /user-x/x1/xx1/xxx1 */ +export async function userXx1Xx1Xxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1/xxxx1 GET /user-x/x1/xx1/xxx1/xxxx1 */ +export async function userXx1Xx1Xxx1Xxxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1/xxxx1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** y1 GET /user-y/y1 */ +export async function userYy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1 GET /user-y/y1/yy1 */ +export async function userYy1Yy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1 GET /user-y/y1/yy1/yyy1 */ +export async function userYy1Yy1Yyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1 GET /user-y/y1/yy1/yyy1/yyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1/yyyyy1 GET /user-y/y1/yy1/yyy1/yyyy1/yyyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1Yyyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1/yyyyy1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/__snapshots__/exclude/should excludeTags case sensitive by default.snap b/test/__snapshots__/exclude/should excludeTags case sensitive by default.snap new file mode 100644 index 0000000..8ef2940 --- /dev/null +++ b/test/__snapshots__/exclude/should excludeTags case sensitive by default.snap @@ -0,0 +1,435 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userY'; +export * from './userX'; +export * from './sysC'; +export * from './sysB'; +export * from './sysA'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** a1 GET /sys-a/a1 */ +export async function sysAa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/aa1 GET /sys-a/a1/aa1 */ +export async function sysAa1Aa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1 GET /sys-a/a1/aa1/aaa1 */ +export async function sysAa1Aa1Aaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1/aaa1 GET /sys-a/a1/aa1/aaa1/aaaa1 */ +export async function sysAa1Aa1Aaa1Aaaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1/aaaa1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** b1 GET /sys-b/b1 */ +export async function sysBb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1 GET /sys-b/b1/bb1 */ +export async function sysBb1Bb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1 GET /sys-b/b1/bb1/bbb1 */ +export async function sysBb1Bb1Bbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1', { + method: 'GET', + ...(options || {}), + }); +} + +/** b1/bb1/bbb1/bbbb1 GET /sys-b/b1/bb1/bbb1/bbbb1 */ +export async function sysBb1Bb1Bbb1Bbbb1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-b/b1/bb1/bbb1/bbbb1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** c1 GET /sys-c/c1 */ +export async function sysCc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1 GET /sys-c/c1/cc1 */ +export async function sysCc1Cc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1 GET /sys-c/c1/cc1/ccc1 */ +export async function sysCc1Cc1Ccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1', { + method: 'GET', + ...(options || {}), + }); +} + +/** c1/cc1/ccc1/cccc1 GET /sys-c/c1/cc1/ccc1/cccc1 */ +export async function sysCc1Cc1Ccc1Cccc1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-c/c1/cc1/ccc1/cccc1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysAa1Aa1Aaa1Aaaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1Aaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1Bbbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1Bbb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1Bb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysBb1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1Cccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1Ccc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1Cc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysCc1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserXx1Xx1Xxx1Xxxx1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserYy1Yy1Yyy1Yyyy1Yyyyy1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** x1 GET /user-x/x1 */ +export async function userXx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1 GET /user-x/x1/xx1 */ +export async function userXx1Xx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1 GET /user-x/x1/xx1/xxx1 */ +export async function userXx1Xx1Xxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1', { + method: 'GET', + ...(options || {}), + }); +} + +/** x1/xx1/xxx1/xxxx1 GET /user-x/x1/xx1/xxx1/xxxx1 */ +export async function userXx1Xx1Xxx1Xxxx1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-x/x1/xx1/xxx1/xxxx1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** y1 GET /user-y/y1 */ +export async function userYy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1 GET /user-y/y1/yy1 */ +export async function userYy1Yy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1 GET /user-y/y1/yy1/yyy1 */ +export async function userYy1Yy1Yyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1 GET /user-y/y1/yy1/yyy1/yyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1', { + method: 'GET', + ...(options || {}), + }); +} + +/** y1/yy1/yyy1/yyyy1/yyyyy1 GET /user-y/y1/yy1/yyy1/yyyy1/yyyyy1 */ +export async function userYy1Yy1Yyy1Yyyy1Yyyyy1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-y/y1/yy1/yyy1/yyyy1/yyyyy1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/__snapshots__/include/should includePaths can be case insensitive.snap b/test/__snapshots__/include/should includePaths can be case insensitive.snap new file mode 100644 index 0000000..be986bb --- /dev/null +++ b/test/__snapshots__/include/should includePaths can be case insensitive.snap @@ -0,0 +1,50 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './sysA'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** a1/a1/aa1 GET /sys-a/a1/aa1/aaa1 */ +export async function sysAa1Aa1Aaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1/aaa1 GET /sys-a/a1/aa1/aaa1/aaaa1 */ +export async function sysAa1Aa1Aaa1Aaaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1/aaaa1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysAa1Aa1Aaa1Aaaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1Aaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; diff --git a/test/__snapshots__/include/should includePaths case sensitive by default.snap b/test/__snapshots__/include/should includePaths case sensitive by default.snap new file mode 100644 index 0000000..1924b51 --- /dev/null +++ b/test/__snapshots__/include/should includePaths case sensitive by default.snap @@ -0,0 +1,6 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; +/* eslint-disable */ +// @ts-ignore +export {}; diff --git a/test/__snapshots__/include/should includeTags can be case insensitive.snap b/test/__snapshots__/include/should includeTags can be case insensitive.snap new file mode 100644 index 0000000..cabbbaf --- /dev/null +++ b/test/__snapshots__/include/should includeTags can be case insensitive.snap @@ -0,0 +1,189 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userZ'; +export * from './sysA'; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** a1 GET /sys-a/a1 */ +export async function sysAa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/aa1 GET /sys-a/a1/aa1 */ +export async function sysAa1Aa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1 GET /sys-a/a1/aa1/aaa1 */ +export async function sysAa1Aa1Aaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1', { + method: 'GET', + ...(options || {}), + }); +} + +/** a1/a1/aa1/aaa1 GET /sys-a/a1/aa1/aaa1/aaaa1 */ +export async function sysAa1Aa1Aaa1Aaaa1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/sys-a/a1/aa1/aaa1/aaaa1', { + method: 'GET', + ...(options || {}), + }); +} +/* eslint-disable */ +// @ts-ignore + +export type SysAa1Aa1Aaa1Aaaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1Aaa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1Aa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type SysAa1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1Zzzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** f1 ffff GET /user-z/z1 */ +export async function userZz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1 GET /user-z/z1/zz1 */ +export async function userZz1Zz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1 GET /user-z/z1/zz1/zzz1 */ +export async function userZz1Zz1Zzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1 GET /user-z/z1/zz1/zzz1/zzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1/zzzzz1 GET /user-z/z1/zz1/zzz1/zzzz1/zzzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1Zzzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1/zzzzz1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/__snapshots__/include/should includeTags case sensitive by default.snap b/test/__snapshots__/include/should includeTags case sensitive by default.snap new file mode 100644 index 0000000..1fa2218 --- /dev/null +++ b/test/__snapshots__/include/should includeTags case sensitive by default.snap @@ -0,0 +1,107 @@ +/* eslint-disable */ +// @ts-ignore +export * from './types'; + +export * from './userZ'; +/* eslint-disable */ +// @ts-ignore + +export type UserZz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; + +export type UserZz1Zz1Zzz1Zzzz1Zzzzz1UsingGetResponses = { + /** + * OK + */ + 200: string; +}; +/* eslint-disable */ +// @ts-ignore +import request from '../request'; + +import * as API from './types'; + +/** f1 ffff GET /user-z/z1 */ +export async function userZz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1 GET /user-z/z1/zz1 */ +export async function userZz1Zz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1 GET /user-z/z1/zz1/zzz1 */ +export async function userZz1Zz1Zzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1 GET /user-z/z1/zz1/zzz1/zzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1', { + method: 'GET', + ...(options || {}), + }); +} + +/** z1/zz1/zzz1/zzzz1/zzzzz1 GET /user-z/z1/zz1/zzz1/zzzz1/zzzzz1 */ +export async function userZz1Zz1Zzz1Zzzz1Zzzzz1UsingGet({ + options, +}: { + options?: { [key: string]: unknown }; +}) { + return request('/user-z/z1/zz1/zzz1/zzzz1/zzzzz1', { + method: 'GET', + ...(options || {}), + }); +} diff --git a/test/exclude.spec.ts b/test/exclude.spec.ts index cce64f3..955708e 100644 --- a/test/exclude.spec.ts +++ b/test/exclude.spec.ts @@ -103,4 +103,76 @@ describe('openAPI.generateService priorityRule=exclude', () => { readGeneratedFiles('./apis/exclude/test5') ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); }); + + /** + * 结果 ['/sys-a/**', '/sys-b/**', '/sys-c/**', '/user-x/**', '/user-y/**'] + */ + it('should excludeTags case sensitive by default', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/exclude/test6', + requestLibPath: '../request', + priorityRule: 'exclude', + enableLogging: true, // 开启日志 + excludeTags: ['sys-A', 'user-z'], + }); + + await expect( + readGeneratedFiles('./apis/exclude/test6') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 ['/sys-b/**', '/sys-c/**', '/user-x/**', '/user-y/**'] + */ + it('should excludeTags can be case insensitive', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/exclude/test7', + requestLibPath: '../request', + priorityRule: 'exclude', + filterCaseInsensitive: true, + excludeTags: ['sys-A', 'user-z'], + }); + + await expect( + readGeneratedFiles('./apis/exclude/test7') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 ['/sys-a/**', '/sys-b/**', '/sys-c/**', '/user-x/**', '/user-y/**', '/user-z/**'] + */ + it('should excludePaths case sensitive by default', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/exclude/test8', + requestLibPath: '../request', + enableLogging: true, // 开启日志 + priorityRule: 'exclude', + excludePaths: ['/sys-A/a1/aa1/**'], + }); + + await expect( + readGeneratedFiles('./apis/exclude/test8') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 ['/sys-b/**', '/sys-c/**', '/user-x/**', '/user-y/**', '/user-z/**'] + */ + it('should excludePaths can be case insensitive', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/exclude/test9', + requestLibPath: '../request', + filterCaseInsensitive: true, + priorityRule: 'exclude', + excludePaths: ['/sys-a/a1/aa1/**'], + }); + + await expect( + readGeneratedFiles('./apis/exclude/test9') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); }); diff --git a/test/include.spec.ts b/test/include.spec.ts index 6f2e0bb..ce4a554 100644 --- a/test/include.spec.ts +++ b/test/include.spec.ts @@ -113,4 +113,74 @@ describe('openAPI.generateService priorityRule=include', () => { readGeneratedFiles('./apis/include/test6') ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); }); + + /** + * 结果 ['/user-z/**'] + */ + it('should includeTags case sensitive by default', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/include/test7', + requestLibPath: '../request', + enableLogging: true, // 开启日志 + priorityRule: 'include', + includeTags: ['sys-A', 'user-z'], + }); + + await expect( + readGeneratedFiles('./apis/include/test7') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 ['/sys-a/**', '/user-z/**'] + */ + it('should includeTags can be case insensitive', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/include/test8', + requestLibPath: '../request', + filterCaseInsensitive: true, + includeTags: ['sys-A', 'user-z'], + }); + + await expect( + readGeneratedFiles('./apis/include/test8') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 [] + */ + it('should includePaths case sensitive by default', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/include/test9', + requestLibPath: '../request', + enableLogging: true, // 开启日志 + priorityRule: 'include', + includePaths: ['/sys-A/a1/aa1/**'], + }); + + await expect( + readGeneratedFiles('./apis/include/test9') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); + + /** + * 结果 ['/sys-a/a1/aa1/**',] + */ + it('should includePaths can be case insensitive', async (ctx) => { + await generateService({ + schemaPath: `${__dirname}/example-files/openapi-priority-rule.json`, + serversPath: './apis/include/test10', + requestLibPath: '../request', + filterCaseInsensitive: true, + includePaths: ['/sys-a/a1/aa1/**'], + }); + + await expect( + readGeneratedFiles('./apis/include/test10') + ).resolves.toMatchFileSnapshot(getSnapshotDir(ctx)); + }); });