openapi-ts-request 1.6.1 → 1.6.3

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.
@@ -361,6 +361,7 @@ class ServiceGenerator {
361
361
  ? (0, util_1.camelCase)(`display-${typeName}-Enum`)
362
362
  : '',
363
363
  enumLabelType: isEnum ? result.enumLabelType : '',
364
+ description: result.description,
364
365
  });
365
366
  }
366
367
  if (this.config.isGenJsonSchemas) {
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) => typeof item === 'string' ? item.toLowerCase() : 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) => typeof item === 'string' ? item.toLowerCase() : 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) => typeof item === 'string' ? item.toLowerCase() : 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) => typeof item === 'string' ? item.toLowerCase() : 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<unknown>;
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
@@ -245,7 +245,7 @@ function translateChineseModuleNodeToEnglish(openAPI) {
245
245
  }
246
246
  });
247
247
  });
248
- resolve(true);
248
+ resolve(translateMap);
249
249
  })
250
250
  .catch(() => {
251
251
  reject(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-ts-request",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
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",
@@ -58,7 +58,7 @@
58
58
  "@types/lodash": "^4.17.5",
59
59
  "@types/memoizee": "^0.4.11",
60
60
  "@types/mockjs": "^1.0.10",
61
- "@types/node": "^22.15.17",
61
+ "@types/node": "^24.0.14",
62
62
  "@types/nunjucks": "^3.2.6",
63
63
  "@types/reserved-words": "^0.1.4",
64
64
  "@types/swagger2openapi": "^7.0.4",