@dazhicheng/openapi 1.1.3 → 1.1.5
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/CHANGELOG.md +12 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -2
- package/src/cli.ts +28 -28
- package/src/index.ts +0 -5
- package/src/serviceGenerator.ts +1093 -1090
- package/src/util.ts +1 -0
- package/src/index.d.ts +0 -141
- package/src/log.d.ts +0 -2
- package/src/mockGenerator.d.ts +0 -8
- package/src/openAPIParserMock/index.d.ts +0 -7
- package/src/openAPIParserMock/primitives.d.ts +0 -31
- package/src/openAPIParserMock/utils.d.ts +0 -8
- package/src/serviceGenerator.d.ts +0 -460
- package/src/typings.d.ts +0 -6
- package/src/util.d.ts +0 -35
package/src/util.ts
CHANGED
|
@@ -29,6 +29,7 @@ export const prettierFile = async (content: string): Promise<[string, boolean]>
|
|
|
29
29
|
result = await prettier.format(content, {
|
|
30
30
|
parser: "typescript",
|
|
31
31
|
...prettierOptions,
|
|
32
|
+
singleQuote: true,
|
|
32
33
|
});
|
|
33
34
|
} catch (error: any) {
|
|
34
35
|
console.error("Prettier error:", error);
|
package/src/index.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIObject, OperationObject, SchemaObject } from "openapi3-ts";
|
|
2
|
-
import type { APIDataType } from "./serviceGenerator";
|
|
3
|
-
export type GenerateServiceProps = {
|
|
4
|
-
requestLibPath?: string;
|
|
5
|
-
requestOptionsType?: string;
|
|
6
|
-
requestImportStatement?: string;
|
|
7
|
-
declareType?: "type" | "interface";
|
|
8
|
-
/**
|
|
9
|
-
* api 的前缀
|
|
10
|
-
*/
|
|
11
|
-
apiPrefix?: string | ((params: {
|
|
12
|
-
path: string;
|
|
13
|
-
method: string;
|
|
14
|
-
namespace: string;
|
|
15
|
-
functionName: string;
|
|
16
|
-
autoExclude?: boolean;
|
|
17
|
-
}) => string);
|
|
18
|
-
/**
|
|
19
|
-
* 生成的文件夹的路径
|
|
20
|
-
*/
|
|
21
|
-
serversPath?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Swagger 2.0 或 OpenAPI 3.0 的地址
|
|
24
|
-
*/
|
|
25
|
-
schemaPath?: string;
|
|
26
|
-
/**
|
|
27
|
-
* 项目名称
|
|
28
|
-
*/
|
|
29
|
-
projectName?: string;
|
|
30
|
-
/**
|
|
31
|
-
* 文档登录凭证
|
|
32
|
-
*/
|
|
33
|
-
authorization?: string;
|
|
34
|
-
hook?: {
|
|
35
|
-
/** change open api data after constructor */
|
|
36
|
-
afterOpenApiDataInited?: (openAPIData: OpenAPIObject) => OpenAPIObject;
|
|
37
|
-
/** 自定义函数名称 */
|
|
38
|
-
customFunctionName?: (data: APIDataType) => string;
|
|
39
|
-
/** 自定义类型名称 */
|
|
40
|
-
customTypeName?: (data: APIDataType) => string;
|
|
41
|
-
/** 自定义 options 默认值 */
|
|
42
|
-
customOptionsDefaultValue?: (data: OperationObject) => Record<string, any> | undefined;
|
|
43
|
-
/** 自定义类名 */
|
|
44
|
-
customClassName?: (tagName: string) => string;
|
|
45
|
-
/**
|
|
46
|
-
* 自定义获取type hook
|
|
47
|
-
* 返回非字符串将使用默认方法获取type
|
|
48
|
-
* @example set number to string
|
|
49
|
-
* function customType(schemaObject,namespace){
|
|
50
|
-
* if(schemaObject.type==='number' && !schemaObject.format){
|
|
51
|
-
* return 'BigDecimalString';
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
customType?: (schemaObject: SchemaObject | undefined, namespace: string, originGetType: (schemaObject: SchemaObject | undefined, namespace: string) => string) => string;
|
|
56
|
-
/**
|
|
57
|
-
* 自定义生成文件名,可返回多个,表示生成多个文件
|
|
58
|
-
* 返回为空,则使用默认的获取方法获取
|
|
59
|
-
* @example 使用operationId生成文件名
|
|
60
|
-
* function customFileNames(operationObject,apiPath){
|
|
61
|
-
* const operationId=operationObject.operationId;
|
|
62
|
-
* if (!operationId) {
|
|
63
|
-
* console.warn('[Warning] no operationId', apiPath);
|
|
64
|
-
* return;
|
|
65
|
-
* }
|
|
66
|
-
* const res = operationId.split('_');
|
|
67
|
-
* if (res.length > 1) {
|
|
68
|
-
* res.shift();
|
|
69
|
-
* if (res.length > 2) {
|
|
70
|
-
* console.warn('[Warning] operationId has more than 2 part', apiPath);
|
|
71
|
-
* }
|
|
72
|
-
* return [res.join('_')];
|
|
73
|
-
* } else {
|
|
74
|
-
* const controllerName = (res || [])[0];
|
|
75
|
-
* if (controllerName) {
|
|
76
|
-
* return [controllerName];
|
|
77
|
-
* }
|
|
78
|
-
* return;
|
|
79
|
-
* }
|
|
80
|
-
* }
|
|
81
|
-
*/
|
|
82
|
-
customFileNames?: (operationObject: OperationObject, apiPath: string, _apiMethod: string) => string[];
|
|
83
|
-
};
|
|
84
|
-
namespace?: string;
|
|
85
|
-
/**
|
|
86
|
-
* 默认为false,true时使用null代替可选
|
|
87
|
-
*/
|
|
88
|
-
nullable?: boolean;
|
|
89
|
-
mockFolder?: string;
|
|
90
|
-
/**
|
|
91
|
-
* 模板文件的文件路径
|
|
92
|
-
*/
|
|
93
|
-
templatesFolder?: string;
|
|
94
|
-
/**
|
|
95
|
-
* 枚举样式
|
|
96
|
-
*/
|
|
97
|
-
enumStyle?: "string-literal" | "enum";
|
|
98
|
-
/**
|
|
99
|
-
* response中数据字段
|
|
100
|
-
* example: ['result', 'res']
|
|
101
|
-
*/
|
|
102
|
-
dataFields?: string[];
|
|
103
|
-
/**
|
|
104
|
-
* 模板文件、请求函数采用小驼峰命名
|
|
105
|
-
*/
|
|
106
|
-
isCamelCase?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* 指定生成的接口路径列表
|
|
109
|
-
* 传入则只生成这些接口,不传则全量生成
|
|
110
|
-
* @example specifiedPaths: ["/user/list", "/user/detail"]
|
|
111
|
-
*/
|
|
112
|
-
specifiedPaths?: string[];
|
|
113
|
-
/**
|
|
114
|
-
* mock配置
|
|
115
|
-
*/
|
|
116
|
-
mockConfig?: {
|
|
117
|
-
/**
|
|
118
|
-
* msw类型mock文件格式. 直接返回对象
|
|
119
|
-
* 举例:
|
|
120
|
-
* // @ts-ignore
|
|
121
|
-
|
|
122
|
-
export default {
|
|
123
|
-
'DELETE /mydata/delete': { message: { message: 'Mydata successfully deleted' } },
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
原文件:
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
import { Request, Response } from 'express';
|
|
130
|
-
|
|
131
|
-
export default {
|
|
132
|
-
'DELETE /mydata/delete': (req: Request, res: Response) => {
|
|
133
|
-
res.status(200).send({ message: { message: 'Mydata successfully deleted' } });
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
*/
|
|
137
|
-
msw?: boolean;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
export declare const getSchema: (schemaPath: string, authorization?: string) => Promise<any>;
|
|
141
|
-
export declare const ttOpenAPI: (configs: GenerateServiceProps[] | GenerateServiceProps) => Promise<void>;
|
package/src/log.d.ts
DELETED
package/src/mockGenerator.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GenerateServiceProps } from "./index";
|
|
2
|
-
export type genMockDataServerConfig = {
|
|
3
|
-
openAPI: any;
|
|
4
|
-
mockFolder: string;
|
|
5
|
-
mockConfig: GenerateServiceProps["mockConfig"];
|
|
6
|
-
};
|
|
7
|
-
declare const mockGenerator: ({ openAPI, mockFolder, mockConfig }: genMockDataServerConfig) => Promise<void>;
|
|
8
|
-
export { mockGenerator };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
string: string;
|
|
3
|
-
string_email: string;
|
|
4
|
-
string_phone: string;
|
|
5
|
-
string_username: string;
|
|
6
|
-
string_url: string;
|
|
7
|
-
string_uuid: string;
|
|
8
|
-
string_id: string;
|
|
9
|
-
string_status: string;
|
|
10
|
-
string_authority: string;
|
|
11
|
-
string_label: string;
|
|
12
|
-
string_group: string;
|
|
13
|
-
string_csentence: string;
|
|
14
|
-
string_cname: string;
|
|
15
|
-
string_name: string;
|
|
16
|
-
string_errorCode: string;
|
|
17
|
-
string_country: string;
|
|
18
|
-
string_county: string;
|
|
19
|
-
string_province: string;
|
|
20
|
-
string_city: string;
|
|
21
|
-
string_avatar: string;
|
|
22
|
-
string_href: string;
|
|
23
|
-
"string_string(16)": string;
|
|
24
|
-
"string_date-time": string;
|
|
25
|
-
string_date: string;
|
|
26
|
-
number: string;
|
|
27
|
-
number_float: string;
|
|
28
|
-
integer: string;
|
|
29
|
-
boolean: string;
|
|
30
|
-
};
|
|
31
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare function isObject(obj: any): boolean;
|
|
2
|
-
declare function objectify(thing: any): any;
|
|
3
|
-
declare function get(entity: any, path: (string | number)[]): any;
|
|
4
|
-
declare function normalizeArray(arr: any): any[];
|
|
5
|
-
declare function isFunc(thing: any): boolean;
|
|
6
|
-
declare function inferSchema(thing: any): any;
|
|
7
|
-
declare function getRandomInt(min: any, max: any): number;
|
|
8
|
-
export { isObject, get, objectify, isFunc, inferSchema, normalizeArray, getRandomInt };
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIObject, OperationObject, ParameterObject, ReferenceObject, RequestBodyObject, ResponsesObject, SchemaObject } from "openapi3-ts";
|
|
2
|
-
import type { GenerateServiceProps } from "./index";
|
|
3
|
-
export type TypescriptFileType = "interface" | "serviceController" | "serviceIndex";
|
|
4
|
-
export interface APIDataType extends OperationObject {
|
|
5
|
-
path: string;
|
|
6
|
-
method: string;
|
|
7
|
-
}
|
|
8
|
-
export type TagAPIDataType = Record<string, APIDataType[]>;
|
|
9
|
-
export interface MappingItemType {
|
|
10
|
-
antTechApi: string;
|
|
11
|
-
popAction: string;
|
|
12
|
-
popProduct: string;
|
|
13
|
-
antTechVersion: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ControllerType {
|
|
16
|
-
fileName: string;
|
|
17
|
-
controllerName: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const getPath: () => string;
|
|
20
|
-
export declare const getGenInfo: (isDirExist: boolean, appName: string, absSrcPath: string) => boolean[];
|
|
21
|
-
declare class ServiceGenerator {
|
|
22
|
-
protected apiData: TagAPIDataType;
|
|
23
|
-
protected classNameList: ControllerType[];
|
|
24
|
-
protected version: string;
|
|
25
|
-
protected mappings: MappingItemType[];
|
|
26
|
-
protected finalPath: string;
|
|
27
|
-
protected config: GenerateServiceProps;
|
|
28
|
-
protected openAPIData: OpenAPIObject;
|
|
29
|
-
constructor(config: GenerateServiceProps, openAPIData: OpenAPIObject);
|
|
30
|
-
genFile(): Promise<void>;
|
|
31
|
-
concatOrNull: (...arrays: any[]) => never[] | null;
|
|
32
|
-
getFuncationName(data: APIDataType): string;
|
|
33
|
-
getTypeName(data: APIDataType): string;
|
|
34
|
-
getServiceTP(): {
|
|
35
|
-
genType: string;
|
|
36
|
-
className: string;
|
|
37
|
-
instanceName: string;
|
|
38
|
-
list: {
|
|
39
|
-
functionName: string;
|
|
40
|
-
typeName: string;
|
|
41
|
-
path: string;
|
|
42
|
-
pathInComment: string;
|
|
43
|
-
hasPathVariables: boolean;
|
|
44
|
-
hasApiPrefix: boolean;
|
|
45
|
-
method: string;
|
|
46
|
-
desc: string | undefined;
|
|
47
|
-
hasHeader: boolean;
|
|
48
|
-
params: Record<string, ParameterObject[]>;
|
|
49
|
-
hasParams: boolean;
|
|
50
|
-
options: Record<string, any>;
|
|
51
|
-
body: {
|
|
52
|
-
required: any;
|
|
53
|
-
propertiesList: ({
|
|
54
|
-
key: string;
|
|
55
|
-
schema: {
|
|
56
|
-
type: string;
|
|
57
|
-
required: boolean;
|
|
58
|
-
$ref: string;
|
|
59
|
-
} | {
|
|
60
|
-
type: string;
|
|
61
|
-
required: boolean;
|
|
62
|
-
nullable?: boolean;
|
|
63
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
64
|
-
readOnly?: boolean;
|
|
65
|
-
writeOnly?: boolean;
|
|
66
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
67
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
68
|
-
example?: any;
|
|
69
|
-
examples?: any[];
|
|
70
|
-
deprecated?: boolean;
|
|
71
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
72
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
73
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
74
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
75
|
-
not?: SchemaObject | ReferenceObject;
|
|
76
|
-
items?: SchemaObject | ReferenceObject;
|
|
77
|
-
properties?: {
|
|
78
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
79
|
-
};
|
|
80
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
81
|
-
description?: string;
|
|
82
|
-
default?: any;
|
|
83
|
-
title?: string;
|
|
84
|
-
multipleOf?: number;
|
|
85
|
-
maximum?: number;
|
|
86
|
-
exclusiveMaximum?: boolean;
|
|
87
|
-
minimum?: number;
|
|
88
|
-
exclusiveMinimum?: boolean;
|
|
89
|
-
maxLength?: number;
|
|
90
|
-
minLength?: number;
|
|
91
|
-
pattern?: string;
|
|
92
|
-
maxItems?: number;
|
|
93
|
-
minItems?: number;
|
|
94
|
-
uniqueItems?: boolean;
|
|
95
|
-
maxProperties?: number;
|
|
96
|
-
minProperties?: number;
|
|
97
|
-
enum?: any[];
|
|
98
|
-
};
|
|
99
|
-
} | undefined)[];
|
|
100
|
-
nullable?: boolean;
|
|
101
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
102
|
-
readOnly?: boolean;
|
|
103
|
-
writeOnly?: boolean;
|
|
104
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
105
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
106
|
-
example?: any;
|
|
107
|
-
examples?: any[];
|
|
108
|
-
deprecated?: boolean;
|
|
109
|
-
type?: "integer" | "number" | "string" | "boolean" | "object" | "null" | "array";
|
|
110
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
111
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
112
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
113
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
114
|
-
not?: SchemaObject | ReferenceObject;
|
|
115
|
-
items?: SchemaObject | ReferenceObject;
|
|
116
|
-
properties?: {
|
|
117
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
118
|
-
};
|
|
119
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
120
|
-
description?: string;
|
|
121
|
-
default?: any;
|
|
122
|
-
title?: string;
|
|
123
|
-
multipleOf?: number;
|
|
124
|
-
maximum?: number;
|
|
125
|
-
exclusiveMaximum?: boolean;
|
|
126
|
-
minimum?: number;
|
|
127
|
-
exclusiveMinimum?: boolean;
|
|
128
|
-
maxLength?: number;
|
|
129
|
-
minLength?: number;
|
|
130
|
-
pattern?: string;
|
|
131
|
-
maxItems?: number;
|
|
132
|
-
minItems?: number;
|
|
133
|
-
uniqueItems?: boolean;
|
|
134
|
-
maxProperties?: number;
|
|
135
|
-
minProperties?: number;
|
|
136
|
-
enum?: any[];
|
|
137
|
-
mediaType: string | undefined;
|
|
138
|
-
} | {
|
|
139
|
-
mediaType: string | undefined;
|
|
140
|
-
required: any;
|
|
141
|
-
type: string;
|
|
142
|
-
} | null;
|
|
143
|
-
file: any;
|
|
144
|
-
hasFormData: boolean;
|
|
145
|
-
response: {
|
|
146
|
-
mediaType: string;
|
|
147
|
-
type: string;
|
|
148
|
-
};
|
|
149
|
-
tags?: string[];
|
|
150
|
-
summary?: string;
|
|
151
|
-
description?: string;
|
|
152
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
153
|
-
operationId?: string;
|
|
154
|
-
parameters?: (ParameterObject | ReferenceObject)[];
|
|
155
|
-
requestBody?: RequestBodyObject | ReferenceObject;
|
|
156
|
-
responses: ResponsesObject;
|
|
157
|
-
callbacks?: import("openapi3-ts").CallbacksObject;
|
|
158
|
-
deprecated?: boolean;
|
|
159
|
-
security?: import("openapi3-ts").SecurityRequirementObject[];
|
|
160
|
-
servers?: import("openapi3-ts").ServerObject[];
|
|
161
|
-
}[];
|
|
162
|
-
}[];
|
|
163
|
-
getBodyTP(requestBody?: any): {
|
|
164
|
-
required: any;
|
|
165
|
-
propertiesList: ({
|
|
166
|
-
key: string;
|
|
167
|
-
schema: {
|
|
168
|
-
type: string;
|
|
169
|
-
required: boolean;
|
|
170
|
-
$ref: string;
|
|
171
|
-
} | {
|
|
172
|
-
type: string;
|
|
173
|
-
required: boolean;
|
|
174
|
-
nullable?: boolean;
|
|
175
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
176
|
-
readOnly?: boolean;
|
|
177
|
-
writeOnly?: boolean;
|
|
178
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
179
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
180
|
-
example?: any;
|
|
181
|
-
examples?: any[];
|
|
182
|
-
deprecated?: boolean;
|
|
183
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
184
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
185
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
186
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
187
|
-
not?: SchemaObject | ReferenceObject;
|
|
188
|
-
items?: SchemaObject | ReferenceObject;
|
|
189
|
-
properties?: {
|
|
190
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
191
|
-
};
|
|
192
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
193
|
-
description?: string;
|
|
194
|
-
default?: any;
|
|
195
|
-
title?: string;
|
|
196
|
-
multipleOf?: number;
|
|
197
|
-
maximum?: number;
|
|
198
|
-
exclusiveMaximum?: boolean;
|
|
199
|
-
minimum?: number;
|
|
200
|
-
exclusiveMinimum?: boolean;
|
|
201
|
-
maxLength?: number;
|
|
202
|
-
minLength?: number;
|
|
203
|
-
pattern?: string;
|
|
204
|
-
maxItems?: number;
|
|
205
|
-
minItems?: number;
|
|
206
|
-
uniqueItems?: boolean;
|
|
207
|
-
maxProperties?: number;
|
|
208
|
-
minProperties?: number;
|
|
209
|
-
enum?: any[];
|
|
210
|
-
};
|
|
211
|
-
} | undefined)[];
|
|
212
|
-
nullable?: boolean;
|
|
213
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
214
|
-
readOnly?: boolean;
|
|
215
|
-
writeOnly?: boolean;
|
|
216
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
217
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
218
|
-
example?: any;
|
|
219
|
-
examples?: any[];
|
|
220
|
-
deprecated?: boolean;
|
|
221
|
-
type?: "integer" | "number" | "string" | "boolean" | "object" | "null" | "array";
|
|
222
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
223
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
224
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
225
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
226
|
-
not?: SchemaObject | ReferenceObject;
|
|
227
|
-
items?: SchemaObject | ReferenceObject;
|
|
228
|
-
properties?: {
|
|
229
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
230
|
-
};
|
|
231
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
232
|
-
description?: string;
|
|
233
|
-
default?: any;
|
|
234
|
-
title?: string;
|
|
235
|
-
multipleOf?: number;
|
|
236
|
-
maximum?: number;
|
|
237
|
-
exclusiveMaximum?: boolean;
|
|
238
|
-
minimum?: number;
|
|
239
|
-
exclusiveMinimum?: boolean;
|
|
240
|
-
maxLength?: number;
|
|
241
|
-
minLength?: number;
|
|
242
|
-
pattern?: string;
|
|
243
|
-
maxItems?: number;
|
|
244
|
-
minItems?: number;
|
|
245
|
-
uniqueItems?: boolean;
|
|
246
|
-
maxProperties?: number;
|
|
247
|
-
minProperties?: number;
|
|
248
|
-
enum?: any[];
|
|
249
|
-
mediaType: string | undefined;
|
|
250
|
-
} | {
|
|
251
|
-
mediaType: string | undefined;
|
|
252
|
-
required: any;
|
|
253
|
-
type: string;
|
|
254
|
-
} | null;
|
|
255
|
-
getFileTP(requestBody?: any): any;
|
|
256
|
-
resolveFileTP(obj: any): any;
|
|
257
|
-
getResponseTP(responses?: ResponsesObject): {
|
|
258
|
-
mediaType: string;
|
|
259
|
-
type: string;
|
|
260
|
-
};
|
|
261
|
-
getParamsTP(parameters?: (ParameterObject | ReferenceObject)[], path?: string): Record<string, ParameterObject[]>;
|
|
262
|
-
private collectRefs;
|
|
263
|
-
getInterfaceTP(): {
|
|
264
|
-
typeName: string;
|
|
265
|
-
type: any;
|
|
266
|
-
parent: any;
|
|
267
|
-
props: any;
|
|
268
|
-
isEnum: any;
|
|
269
|
-
}[] | undefined;
|
|
270
|
-
private genFileFromTemplate;
|
|
271
|
-
private getTemplate;
|
|
272
|
-
getProps(schemaObject: SchemaObject): {
|
|
273
|
-
name: string;
|
|
274
|
-
type: string;
|
|
275
|
-
desc: string;
|
|
276
|
-
required: boolean;
|
|
277
|
-
nullable?: boolean;
|
|
278
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
279
|
-
readOnly?: boolean;
|
|
280
|
-
writeOnly?: boolean;
|
|
281
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
282
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
283
|
-
example?: any;
|
|
284
|
-
examples?: any[];
|
|
285
|
-
deprecated?: boolean;
|
|
286
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
287
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
288
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
289
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
290
|
-
not?: SchemaObject | ReferenceObject;
|
|
291
|
-
items?: SchemaObject | ReferenceObject;
|
|
292
|
-
properties?: {
|
|
293
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
294
|
-
};
|
|
295
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
296
|
-
description?: string;
|
|
297
|
-
default?: any;
|
|
298
|
-
title?: string;
|
|
299
|
-
multipleOf?: number;
|
|
300
|
-
maximum?: number;
|
|
301
|
-
exclusiveMaximum?: boolean;
|
|
302
|
-
minimum?: number;
|
|
303
|
-
exclusiveMinimum?: boolean;
|
|
304
|
-
maxLength?: number;
|
|
305
|
-
minLength?: number;
|
|
306
|
-
pattern?: string;
|
|
307
|
-
maxItems?: number;
|
|
308
|
-
minItems?: number;
|
|
309
|
-
uniqueItems?: boolean;
|
|
310
|
-
maxProperties?: number;
|
|
311
|
-
minProperties?: number;
|
|
312
|
-
enum?: any[];
|
|
313
|
-
}[];
|
|
314
|
-
getType(schemaObject: SchemaObject | undefined, namespace?: string): string;
|
|
315
|
-
resolveObject(schemaObject: SchemaObject): any;
|
|
316
|
-
resolveArray(schemaObject: SchemaObject): "any[]" | {
|
|
317
|
-
type: string;
|
|
318
|
-
};
|
|
319
|
-
resolveProperties(schemaObject: SchemaObject): {
|
|
320
|
-
props: {
|
|
321
|
-
name: string;
|
|
322
|
-
type: string;
|
|
323
|
-
desc: string;
|
|
324
|
-
required: boolean;
|
|
325
|
-
nullable?: boolean;
|
|
326
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
327
|
-
readOnly?: boolean;
|
|
328
|
-
writeOnly?: boolean;
|
|
329
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
330
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
331
|
-
example?: any;
|
|
332
|
-
examples?: any[];
|
|
333
|
-
deprecated?: boolean;
|
|
334
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
335
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
336
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
337
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
338
|
-
not?: SchemaObject | ReferenceObject;
|
|
339
|
-
items?: SchemaObject | ReferenceObject;
|
|
340
|
-
properties?: {
|
|
341
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
342
|
-
};
|
|
343
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
344
|
-
description?: string;
|
|
345
|
-
default?: any;
|
|
346
|
-
title?: string;
|
|
347
|
-
multipleOf?: number;
|
|
348
|
-
maximum?: number;
|
|
349
|
-
exclusiveMaximum?: boolean;
|
|
350
|
-
minimum?: number;
|
|
351
|
-
exclusiveMinimum?: boolean;
|
|
352
|
-
maxLength?: number;
|
|
353
|
-
minLength?: number;
|
|
354
|
-
pattern?: string;
|
|
355
|
-
maxItems?: number;
|
|
356
|
-
minItems?: number;
|
|
357
|
-
uniqueItems?: boolean;
|
|
358
|
-
maxProperties?: number;
|
|
359
|
-
minProperties?: number;
|
|
360
|
-
enum?: any[];
|
|
361
|
-
}[][];
|
|
362
|
-
};
|
|
363
|
-
resolveEnumObject(schemaObject: SchemaObject): {
|
|
364
|
-
isEnum: boolean;
|
|
365
|
-
type: string | undefined;
|
|
366
|
-
};
|
|
367
|
-
resolveAllOfObject(schemaObject: SchemaObject): {
|
|
368
|
-
props: ({
|
|
369
|
-
name: string;
|
|
370
|
-
type: string;
|
|
371
|
-
desc: string;
|
|
372
|
-
required: boolean;
|
|
373
|
-
nullable?: boolean;
|
|
374
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
375
|
-
readOnly?: boolean;
|
|
376
|
-
writeOnly?: boolean;
|
|
377
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
378
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
379
|
-
example?: any;
|
|
380
|
-
examples?: any[];
|
|
381
|
-
deprecated?: boolean;
|
|
382
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
383
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
384
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
385
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
386
|
-
not?: SchemaObject | ReferenceObject;
|
|
387
|
-
items?: SchemaObject | ReferenceObject;
|
|
388
|
-
properties?: {
|
|
389
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
390
|
-
};
|
|
391
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
392
|
-
description?: string;
|
|
393
|
-
default?: any;
|
|
394
|
-
title?: string;
|
|
395
|
-
multipleOf?: number;
|
|
396
|
-
maximum?: number;
|
|
397
|
-
exclusiveMaximum?: boolean;
|
|
398
|
-
minimum?: number;
|
|
399
|
-
exclusiveMinimum?: boolean;
|
|
400
|
-
maxLength?: number;
|
|
401
|
-
minLength?: number;
|
|
402
|
-
pattern?: string;
|
|
403
|
-
maxItems?: number;
|
|
404
|
-
minItems?: number;
|
|
405
|
-
uniqueItems?: boolean;
|
|
406
|
-
maxProperties?: number;
|
|
407
|
-
minProperties?: number;
|
|
408
|
-
enum?: any[];
|
|
409
|
-
}[] | ({
|
|
410
|
-
type: string | undefined;
|
|
411
|
-
$ref: string;
|
|
412
|
-
} | {
|
|
413
|
-
type: string | undefined;
|
|
414
|
-
nullable?: boolean;
|
|
415
|
-
discriminator?: import("openapi3-ts").DiscriminatorObject;
|
|
416
|
-
readOnly?: boolean;
|
|
417
|
-
writeOnly?: boolean;
|
|
418
|
-
xml?: import("openapi3-ts").XmlObject;
|
|
419
|
-
externalDocs?: import("openapi3-ts").ExternalDocumentationObject;
|
|
420
|
-
example?: any;
|
|
421
|
-
examples?: any[];
|
|
422
|
-
deprecated?: boolean;
|
|
423
|
-
format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password" | string;
|
|
424
|
-
allOf?: (SchemaObject | ReferenceObject)[];
|
|
425
|
-
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
426
|
-
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
427
|
-
not?: SchemaObject | ReferenceObject;
|
|
428
|
-
items?: SchemaObject | ReferenceObject;
|
|
429
|
-
properties?: {
|
|
430
|
-
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
431
|
-
};
|
|
432
|
-
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
433
|
-
description?: string;
|
|
434
|
-
default?: any;
|
|
435
|
-
title?: string;
|
|
436
|
-
multipleOf?: number;
|
|
437
|
-
maximum?: number;
|
|
438
|
-
exclusiveMaximum?: boolean;
|
|
439
|
-
minimum?: number;
|
|
440
|
-
exclusiveMinimum?: boolean;
|
|
441
|
-
maxLength?: number;
|
|
442
|
-
minLength?: number;
|
|
443
|
-
pattern?: string;
|
|
444
|
-
maxItems?: number;
|
|
445
|
-
minItems?: number;
|
|
446
|
-
uniqueItems?: boolean;
|
|
447
|
-
maxProperties?: number;
|
|
448
|
-
minProperties?: number;
|
|
449
|
-
required?: string[];
|
|
450
|
-
enum?: any[];
|
|
451
|
-
})[])[];
|
|
452
|
-
};
|
|
453
|
-
private genDefaultFunctionName;
|
|
454
|
-
private getBasePrefix;
|
|
455
|
-
private resolveRefObject;
|
|
456
|
-
private getFinalFileName;
|
|
457
|
-
private replaceDot;
|
|
458
|
-
private resolveFunctionName;
|
|
459
|
-
}
|
|
460
|
-
export { ServiceGenerator };
|