openapi-ts-request 0.9.0 → 0.10.0
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.
|
@@ -607,6 +607,7 @@ class ServiceGenerator {
|
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
609
|
resolveEnumObject(schemaObject) {
|
|
610
|
+
var _a;
|
|
610
611
|
const enumArray = schemaObject.enum;
|
|
611
612
|
let enumStr = '';
|
|
612
613
|
let enumLabelTypeStr = '';
|
|
@@ -623,6 +624,12 @@ class ServiceGenerator {
|
|
|
623
624
|
return `${value}:"${schemaObject['x-enum-comments'][enumKey]}"`;
|
|
624
625
|
}).join(',')}}`;
|
|
625
626
|
}
|
|
627
|
+
else if ((_a = schemaObject === null || schemaObject === void 0 ? void 0 : schemaObject['x-apifox']) === null || _a === void 0 ? void 0 : _a['enumDescriptions']) {
|
|
628
|
+
enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => {
|
|
629
|
+
const enumLabel = schemaObject['x-apifox']['enumDescriptions'][value];
|
|
630
|
+
return `${value}:"${enumLabel}"`;
|
|
631
|
+
}).join(',')}}`;
|
|
632
|
+
}
|
|
626
633
|
else {
|
|
627
634
|
if (!config_1.numberEnum.includes(schemaObject.type)) {
|
|
628
635
|
enumLabelTypeStr = `{${(0, lodash_1.map)(enumArray, (value) => `${value}:"${value}"`).join(',')}}`;
|
|
@@ -44,6 +44,9 @@ export declare function inferSchema(thing: ParameterObject | SchemaObject | Refe
|
|
|
44
44
|
'x-enum-comments'?: {
|
|
45
45
|
[name: string]: string;
|
|
46
46
|
};
|
|
47
|
+
'x-apifox'?: {
|
|
48
|
+
enumDescriptions: Record<string, string>;
|
|
49
|
+
};
|
|
47
50
|
items: import("../type").ISchemaObject;
|
|
48
51
|
} | {
|
|
49
52
|
type: string;
|
|
@@ -86,5 +89,8 @@ export declare function inferSchema(thing: ParameterObject | SchemaObject | Refe
|
|
|
86
89
|
'x-enum-comments'?: {
|
|
87
90
|
[name: string]: string;
|
|
88
91
|
};
|
|
92
|
+
'x-apifox'?: {
|
|
93
|
+
enumDescriptions: Record<string, string>;
|
|
94
|
+
};
|
|
89
95
|
};
|
|
90
96
|
export declare function getRandomInt(min: number, max: number): number;
|
package/dist/type.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ type ICustomBaseSchemaObject = {
|
|
|
14
14
|
'x-enum-comments'?: {
|
|
15
15
|
[name: string]: string;
|
|
16
16
|
};
|
|
17
|
+
'x-apifox'?: {
|
|
18
|
+
enumDescriptions: Record<string, string>;
|
|
19
|
+
};
|
|
17
20
|
};
|
|
18
21
|
export type ArraySchemaObject = Modify<OpenAPIV3.ArraySchemaObject, ICustomBaseSchemaObject & {
|
|
19
22
|
items: ISchemaObject;
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-request",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Swagger2/OpenAPI3 to TypeScript, request client, request mock service, enum, type field label, JSON Schemas",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18.0.0",
|
|
7
|
+
"pnpm": ">=9"
|
|
8
|
+
},
|
|
5
9
|
"repository": {
|
|
6
10
|
"type": "git",
|
|
7
11
|
"url": "git+git@github.com:openapi-ui/openapi-ts-request.git"
|