openapi-ts-request 1.5.1 → 1.5.2

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.
@@ -796,7 +796,7 @@ class ServiceGenerator {
796
796
  enumStr = `{${(0, lodash_1.map)(enumArray, (value) => `"STRING_NUMBER_${value}"="${value}"`).join(',')}}`;
797
797
  }
798
798
  else {
799
- enumStr = `{${(0, lodash_1.map)(enumArray, (value) => `${value}="${value}"`).join(',')}}`;
799
+ enumStr = `{${(0, lodash_1.map)(enumArray, (value) => `"${value}"="${value}"`).join(',')}}`;
800
800
  }
801
801
  // 翻译枚举
802
802
  if (schemaObject['x-enum-varnames'] && schemaObject['x-enum-comments']) {
@@ -835,7 +835,7 @@ class ServiceGenerator {
835
835
  enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => `"${value}":"STRING_NUMBER_${value}"`).join(',')}}`;
836
836
  }
837
837
  else {
838
- enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => `${value}:"${value}"`).join(',')}}`;
838
+ enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => `"${value}":"${value}"`).join(',')}}`;
839
839
  }
840
840
  }
841
841
  return {
package/dist/index.d.ts CHANGED
@@ -206,4 +206,4 @@ export type GenerateServiceProps = {
206
206
  };
207
207
  };
208
208
  };
209
- export declare function generateService({ requestLibPath, schemaPath, mockFolder, includeTags, excludeTags, authorization, isTranslateToEnglishTag, priorityRule, timeout, reactQueryMode, apifoxConfig, ...rest }: GenerateServiceProps): Promise<void>;
209
+ export declare function generateService({ requestLibPath, schemaPath, mockFolder, includeTags, excludeTags, includePaths, excludePaths, authorization, isTranslateToEnglishTag, priorityRule, timeout, reactQueryMode, apifoxConfig, ...rest }: GenerateServiceProps): Promise<void>;
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ const util_1 = require("./util");
11
11
  tslib_1.__exportStar(require("./generator/patchSchema"), exports);
12
12
  function generateService(_a) {
13
13
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- var { requestLibPath, schemaPath, mockFolder, includeTags, excludeTags, authorization, isTranslateToEnglishTag, priorityRule = config_1.PriorityRule.include, timeout = 60000, reactQueryMode = config_1.ReactQueryMode.react, apifoxConfig } = _a, rest = tslib_1.__rest(_a, ["requestLibPath", "schemaPath", "mockFolder", "includeTags", "excludeTags", "authorization", "isTranslateToEnglishTag", "priorityRule", "timeout", "reactQueryMode", "apifoxConfig"]);
14
+ var { requestLibPath, schemaPath, mockFolder, includeTags, excludeTags, includePaths, excludePaths, authorization, isTranslateToEnglishTag, priorityRule = config_1.PriorityRule.include, timeout = 60000, reactQueryMode = config_1.ReactQueryMode.react, apifoxConfig } = _a, rest = tslib_1.__rest(_a, ["requestLibPath", "schemaPath", "mockFolder", "includeTags", "excludeTags", "includePaths", "excludePaths", "authorization", "isTranslateToEnglishTag", "priorityRule", "timeout", "reactQueryMode", "apifoxConfig"]);
15
15
  if (!schemaPath && !apifoxConfig) {
16
16
  return;
17
17
  }
@@ -31,10 +31,18 @@ function generateService(_a) {
31
31
  const requestImportStatement = (0, util_1.getImportStatement)(requestLibPath);
32
32
  const serviceGenerator = new serviceGenarator_1.default(Object.assign({ schemaPath, serversPath: './src/apis', requestImportStatement, enableLogging: false, priorityRule, includeTags: includeTags
33
33
  ? (0, lodash_1.map)(includeTags, (item) => typeof item === 'string' ? item.toLowerCase() : item)
34
- : priorityRule === config_1.PriorityRule.include
34
+ : priorityRule === config_1.PriorityRule.include ||
35
+ priorityRule === config_1.PriorityRule.both
36
+ ? [/.*/g]
37
+ : null, includePaths: includePaths
38
+ ? (0, lodash_1.map)(includePaths, (item) => typeof item === 'string' ? item.toLowerCase() : item)
39
+ : priorityRule === config_1.PriorityRule.include ||
40
+ priorityRule === config_1.PriorityRule.both
35
41
  ? [/.*/g]
36
42
  : null, excludeTags: excludeTags
37
43
  ? (0, lodash_1.map)(excludeTags, (item) => typeof item === 'string' ? item.toLowerCase() : item)
44
+ : null, excludePaths: excludePaths
45
+ ? (0, lodash_1.map)(excludePaths, (item) => typeof item === 'string' ? item.toLowerCase() : item)
38
46
  : 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);
39
47
  serviceGenerator.genFile();
40
48
  if (mockFolder) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-ts-request",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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",