openapi-ts-request 0.13.2 → 0.13.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.
@@ -722,6 +722,13 @@ class ServiceGenerator {
722
722
  return `${value}:"${enumLabel}"`;
723
723
  }).join(',')}}`;
724
724
  }
725
+ else if (schemaObject === null || schemaObject === void 0 ? void 0 : schemaObject['x-apifox-enum']) {
726
+ enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => {
727
+ var _a;
728
+ const enumLabel = (_a = (0, lodash_1.find)(schemaObject['x-apifox-enum'], (item) => item.value === value)) === null || _a === void 0 ? void 0 : _a.description;
729
+ return `${value}:"${enumLabel}"`;
730
+ }).join(',')}}`;
731
+ }
725
732
  else {
726
733
  if (config_1.numberEnum.includes(schemaObject.type) || (0, util_1.isAllNumber)(enumArray)) {
727
734
  enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => `"NUMBER_${value}":${Number(value)}`).join(',')}}`;
@@ -47,6 +47,11 @@ export declare function inferSchema(thing: ParameterObject | SchemaObject | Refe
47
47
  'x-apifox'?: {
48
48
  enumDescriptions: Record<string, string>;
49
49
  };
50
+ 'x-apifox-enum'?: {
51
+ value: string;
52
+ name: string;
53
+ description: string;
54
+ }[];
50
55
  items: import("../type").ISchemaObject;
51
56
  } | {
52
57
  type: string;
@@ -92,5 +97,10 @@ export declare function inferSchema(thing: ParameterObject | SchemaObject | Refe
92
97
  'x-apifox'?: {
93
98
  enumDescriptions: Record<string, string>;
94
99
  };
100
+ 'x-apifox-enum'?: {
101
+ value: string;
102
+ name: string;
103
+ description: string;
104
+ }[];
95
105
  };
96
106
  export declare function getRandomInt(min: number, max: number): number;
package/dist/type.d.ts CHANGED
@@ -17,6 +17,11 @@ type ICustomBaseSchemaObject = {
17
17
  'x-apifox'?: {
18
18
  enumDescriptions: Record<string, string>;
19
19
  };
20
+ 'x-apifox-enum'?: {
21
+ value: string;
22
+ name: string;
23
+ description: string;
24
+ }[];
20
25
  };
21
26
  export type ArraySchemaObject = Modify<OpenAPIV3.ArraySchemaObject, ICustomBaseSchemaObject & {
22
27
  items: ISchemaObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-ts-request",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "Swagger2/OpenAPI3 to TypeScript, request client, request mock service, enum, type field label, JSON Schemas",
5
5
  "engines": {
6
6
  "node": ">=18.0.0",