openapi-ts-request 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -5
- package/dist/util.d.ts +1 -1
- package/dist/util.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -25,23 +25,28 @@ function generateService(_a) {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
if (isTranslateToEnglishTag) {
|
|
28
|
-
yield (0, util_1.translateChineseModuleNodeToEnglish)(openAPI);
|
|
28
|
+
const res = yield (0, util_1.translateChineseModuleNodeToEnglish)(openAPI);
|
|
29
|
+
if ((0, lodash_1.isObject)(res) && !(0, lodash_1.isEmpty)(includeTags)) {
|
|
30
|
+
includeTags = (0, lodash_1.map)(includeTags, (item) => {
|
|
31
|
+
return (0, lodash_1.isString)(item) ? res[item] || item : item;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
const requestImportStatement = (0, util_1.getImportStatement)(requestLibPath);
|
|
31
36
|
const serviceGenerator = new serviceGenarator_1.default(Object.assign({ schemaPath, serversPath: './src/apis', requestImportStatement, enableLogging: false, priorityRule, includeTags: includeTags
|
|
32
|
-
? (0, lodash_1.map)(includeTags, (item) =>
|
|
37
|
+
? (0, lodash_1.map)(includeTags, (item) => (0, lodash_1.isString)(item) ? item.toLowerCase() : item)
|
|
33
38
|
: priorityRule === config_1.PriorityRule.include ||
|
|
34
39
|
priorityRule === config_1.PriorityRule.both
|
|
35
40
|
? [/.*/g]
|
|
36
41
|
: null, includePaths: includePaths
|
|
37
|
-
? (0, lodash_1.map)(includePaths, (item) =>
|
|
42
|
+
? (0, lodash_1.map)(includePaths, (item) => (0, lodash_1.isString)(item) ? item.toLowerCase() : item)
|
|
38
43
|
: priorityRule === config_1.PriorityRule.include ||
|
|
39
44
|
priorityRule === config_1.PriorityRule.both
|
|
40
45
|
? [/.*/g]
|
|
41
46
|
: null, excludeTags: excludeTags
|
|
42
|
-
? (0, lodash_1.map)(excludeTags, (item) =>
|
|
47
|
+
? (0, lodash_1.map)(excludeTags, (item) => (0, lodash_1.isString)(item) ? item.toLowerCase() : item)
|
|
43
48
|
: null, excludePaths: excludePaths
|
|
44
|
-
? (0, lodash_1.map)(excludePaths, (item) =>
|
|
49
|
+
? (0, lodash_1.map)(excludePaths, (item) => (0, lodash_1.isString)(item) ? item.toLowerCase() : item)
|
|
45
50
|
: null, requestOptionsType: '{[key: string]: unknown}', namespace: 'API', isGenReactQuery: false, reactQueryMode, isGenJavaScript: false, isDisplayTypeLabel: false, isGenJsonSchemas: false, nullable: false, isOnlyGenTypeScriptType: false, isCamelCase: true, isSupportParseEnumDesc: false, full: true }, rest), openAPI);
|
|
46
51
|
serviceGenerator.genFile();
|
|
47
52
|
if (mockFolder) {
|
package/dist/util.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const getImportStatement: (requestLibPath: string) => string;
|
|
|
5
5
|
export declare const getOpenAPIConfigByApifox: (props: GetSchemaByApifoxProps) => Promise<OpenAPI.Document<{}>>;
|
|
6
6
|
export declare const getOpenAPIConfig: (schemaPath: string, authorization?: string, timeout?: number) => Promise<OpenAPI.Document<{}>>;
|
|
7
7
|
export declare function parseSwaggerOrOpenapi(content: string | OpenAPI.Document): Promise<OpenAPI.Document<{}>>;
|
|
8
|
-
export declare function translateChineseModuleNodeToEnglish(openAPI: OpenAPIObject): Promise<
|
|
8
|
+
export declare function translateChineseModuleNodeToEnglish(openAPI: OpenAPIObject): Promise<boolean | Record<string, string>>;
|
|
9
9
|
/**
|
|
10
10
|
* Converts a string to camelCase format, with an option to capitalize the first letter.
|
|
11
11
|
* 将字符串转换为驼峰格式,并可以选择将首字母大写。
|
package/dist/util.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-request",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"commander": "^12.1.0",
|
|
33
33
|
"cosmiconfig": "^9.0.0",
|
|
34
34
|
"cosmiconfig-typescript-loader": "^6.1.0",
|
|
35
|
-
"glob": "^
|
|
35
|
+
"glob": "^10.4.5",
|
|
36
36
|
"js-yaml": "^4.1.0",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"memoizee": "^0.4.17",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"nunjucks": "^3.2.4",
|
|
42
42
|
"prettier": "^3.3.2",
|
|
43
43
|
"reserved-words": "^0.1.2",
|
|
44
|
-
"rimraf": "^
|
|
44
|
+
"rimraf": "^5.0.10",
|
|
45
45
|
"swagger2openapi": "^7.0.8",
|
|
46
46
|
"tiny-pinyin": "^1.3.2",
|
|
47
47
|
"ts-morph": "^25.0.1",
|