@visulima/jsdoc-open-api 1.0.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.
- package/CHANGELOG.md +19 -0
- package/LICENSE.md +0 -0
- package/README.md +226 -0
- package/bin/index.js +188 -0
- package/dist/index.d.ts +303 -0
- package/dist/index.js +633 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +633 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +135 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { Configuration } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface BaseDefinition {
|
|
4
|
+
openapi: string;
|
|
5
|
+
info: InfoObject;
|
|
6
|
+
servers?: ServerObject[];
|
|
7
|
+
paths?: PathsObject;
|
|
8
|
+
components?: ComponentsObject;
|
|
9
|
+
security?: SecurityRequirementObject[];
|
|
10
|
+
tags?: TagObject[];
|
|
11
|
+
externalDocs?: ExternalDocumentationObject;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface OpenApiObject extends BaseDefinition {
|
|
15
|
+
paths: PathsObject;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface InfoObject {
|
|
19
|
+
title: string;
|
|
20
|
+
version: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
termsOfService?: string;
|
|
23
|
+
contact?: ContactObject;
|
|
24
|
+
license?: LicenseObject;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ContactObject {
|
|
28
|
+
name?: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface LicenseObject {
|
|
34
|
+
name: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ServerObject {
|
|
39
|
+
url: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
variables?: Map<ServerVariable>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface ServerVariable {
|
|
45
|
+
default: string;
|
|
46
|
+
enum?: string[];
|
|
47
|
+
description?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ComponentsObject {
|
|
51
|
+
schemas?: Map<SchemaObject | ReferenceObject>;
|
|
52
|
+
responses?: Map<ResponseObject | ReferenceObject>;
|
|
53
|
+
parameters?: Map<ParameterObject | ReferenceObject>;
|
|
54
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
55
|
+
requestBodies?: Map<RequestBodyObject | ReferenceObject>;
|
|
56
|
+
headers?: Map<HeaderObject | ReferenceObject>;
|
|
57
|
+
securitySchemes?: Map<
|
|
58
|
+
ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject | ReferenceObject
|
|
59
|
+
>;
|
|
60
|
+
links?: Map<LinkObject | ReferenceObject>;
|
|
61
|
+
callbacks?: Map<CallbackObject | ReferenceObject>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface PathsObject {
|
|
65
|
+
[path: string]: PathItemObject;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface PathItemObject {
|
|
69
|
+
$ref?: string;
|
|
70
|
+
summary?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
get?: OperationObject;
|
|
73
|
+
put?: OperationObject;
|
|
74
|
+
post?: OperationObject;
|
|
75
|
+
delete?: OperationObject;
|
|
76
|
+
options?: OperationObject;
|
|
77
|
+
head?: OperationObject;
|
|
78
|
+
patch?: OperationObject;
|
|
79
|
+
trace?: OperationObject;
|
|
80
|
+
servers?: ServerObject[];
|
|
81
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface OperationObject {
|
|
85
|
+
responses: ResponsesObject;
|
|
86
|
+
tags?: string[];
|
|
87
|
+
summary?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
externalDocs?: ExternalDocumentationObject;
|
|
90
|
+
operationId?: string;
|
|
91
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
92
|
+
requestBody?: RequestBodyObject | ReferenceObject;
|
|
93
|
+
callbacks?: Map<CallbackObject | ReferenceObject>;
|
|
94
|
+
deprecated?: boolean;
|
|
95
|
+
security?: SecurityRequirementObject[];
|
|
96
|
+
servers?: ServerObject[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface ExternalDocumentationObject {
|
|
100
|
+
url: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface ParameterObject {
|
|
105
|
+
name: string;
|
|
106
|
+
in: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
required?: boolean;
|
|
109
|
+
deprecated?: boolean;
|
|
110
|
+
allowEmptyValue?: boolean;
|
|
111
|
+
//
|
|
112
|
+
style?: string;
|
|
113
|
+
explode?: string;
|
|
114
|
+
allowReserved?: boolean;
|
|
115
|
+
schema?: SchemaObject | ReferenceObject;
|
|
116
|
+
example?: any;
|
|
117
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
118
|
+
//
|
|
119
|
+
content?: Map<MediaTypeObject>;
|
|
120
|
+
// ignoring stylings: matrix, label, form, simple, spaceDelimited,
|
|
121
|
+
// pipeDelimited and deepObject
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface RequestBodyObject {
|
|
125
|
+
content: Map<MediaTypeObject>;
|
|
126
|
+
description?: string;
|
|
127
|
+
required?: boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface MediaTypeObject {
|
|
131
|
+
schema?: SchemaObject | ReferenceObject;
|
|
132
|
+
example?: any;
|
|
133
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
134
|
+
encoding?: Map<EncodingObject>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface EncodingObject {
|
|
138
|
+
contentType?: string;
|
|
139
|
+
headers?: Map<HeaderObject | ReferenceObject>;
|
|
140
|
+
style?: string;
|
|
141
|
+
explode?: boolean;
|
|
142
|
+
allowReserved?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface ResponsesObject {
|
|
146
|
+
[code: string]: ResponseObject | ReferenceObject;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface ResponseObject {
|
|
150
|
+
description: string;
|
|
151
|
+
headers?: Map<HeaderObject | ReferenceObject>;
|
|
152
|
+
content?: Map<MediaTypeObject>;
|
|
153
|
+
links?: Map<LinkObject | ReferenceObject>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface CallbackObject {
|
|
157
|
+
[expression: string]: PathItemObject;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface ExampleObject {
|
|
161
|
+
summary?: string;
|
|
162
|
+
description?: string;
|
|
163
|
+
value?: any;
|
|
164
|
+
externalValue?: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface LinkObject {
|
|
168
|
+
operationRef?: string;
|
|
169
|
+
operationId?: string;
|
|
170
|
+
parameters?: Map<any>;
|
|
171
|
+
requestBody?: any;
|
|
172
|
+
description?: string;
|
|
173
|
+
server?: ServerObject;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface HeaderObject {
|
|
177
|
+
description?: string;
|
|
178
|
+
required?: boolean;
|
|
179
|
+
deprecated?: boolean;
|
|
180
|
+
allowEmptyValue?: boolean;
|
|
181
|
+
//
|
|
182
|
+
style?: string;
|
|
183
|
+
explode?: string;
|
|
184
|
+
allowReserved?: boolean;
|
|
185
|
+
schema?: SchemaObject | ReferenceObject;
|
|
186
|
+
example?: any;
|
|
187
|
+
examples?: Map<ExampleObject | ReferenceObject>;
|
|
188
|
+
//
|
|
189
|
+
content?: Map<MediaTypeObject>;
|
|
190
|
+
// ignoring stylings: matrix, label, form, simple, spaceDelimited,
|
|
191
|
+
// pipeDelimited and deepObject
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface TagObject {
|
|
195
|
+
name: string;
|
|
196
|
+
description?: string;
|
|
197
|
+
externalDocs?: ExternalDocumentationObject;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface ReferenceObject {
|
|
201
|
+
$ref: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// TODO: this could be expanded on.
|
|
205
|
+
interface SchemaObject {
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface ApiKeySecuritySchemeObject {
|
|
210
|
+
type: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
name: string;
|
|
213
|
+
in: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface HttpSecuritySchemeObject {
|
|
217
|
+
type: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
scheme: string;
|
|
220
|
+
bearerFormat?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface Oauth2SecuritySchemeObject {
|
|
224
|
+
type: string;
|
|
225
|
+
description?: string;
|
|
226
|
+
flows: OAuthFlowsObject;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface OpenIdConnectSecuritySchemeObject {
|
|
230
|
+
type: string;
|
|
231
|
+
description?: string;
|
|
232
|
+
openIdConnectUrl: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface OAuthFlowsObject {
|
|
236
|
+
implicit?: OAuthFlowObject;
|
|
237
|
+
password?: OAuthFlowObject;
|
|
238
|
+
clientCredentials?: OAuthFlowObject;
|
|
239
|
+
authorizationCode?: OAuthFlowObject;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface OAuthFlowObject {
|
|
243
|
+
authorizationUrl?: string; // required for some?
|
|
244
|
+
tokenUrl?: string; // required for some?
|
|
245
|
+
refreshUrl: string;
|
|
246
|
+
scopes: Map<string>;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface SecurityRequirementObject {
|
|
250
|
+
[name: string]: string[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface Map<T> {
|
|
254
|
+
[key: string]: T;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare class SpecBuilder implements OpenApiObject {
|
|
258
|
+
openapi: string;
|
|
259
|
+
info: InfoObject;
|
|
260
|
+
servers?: ServerObject[];
|
|
261
|
+
paths: PathsObject;
|
|
262
|
+
components?: ComponentsObject;
|
|
263
|
+
security?: SecurityRequirementObject[];
|
|
264
|
+
tags?: TagObject[];
|
|
265
|
+
externalDocs?: ExternalDocumentationObject;
|
|
266
|
+
constructor(baseDefinition: BaseDefinition);
|
|
267
|
+
addData(parsedFile: OpenApiObject[]): void;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare const parseFile: (file: string, commentsToOpenApi: (fileContent: string, verbose?: boolean) => {
|
|
271
|
+
spec: OpenApiObject;
|
|
272
|
+
loc: number;
|
|
273
|
+
}[], verbose?: boolean) => {
|
|
274
|
+
spec: OpenApiObject;
|
|
275
|
+
loc: number;
|
|
276
|
+
}[];
|
|
277
|
+
|
|
278
|
+
declare function yamlLoc(string: string): number;
|
|
279
|
+
|
|
280
|
+
declare class SwaggerCompilerPlugin {
|
|
281
|
+
private readonly swaggerDefinition;
|
|
282
|
+
private readonly sources;
|
|
283
|
+
private readonly verbose;
|
|
284
|
+
private ignore;
|
|
285
|
+
assetsPath: string;
|
|
286
|
+
constructor(assetsPath: string, sources: string[], swaggerDefinition: BaseDefinition, options: {
|
|
287
|
+
verbose?: boolean;
|
|
288
|
+
ignore?: string | ReadonlyArray<string>;
|
|
289
|
+
});
|
|
290
|
+
apply(compiler: Configuration): void;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
declare const commentsToOpenApi$1: (fileContents: string, verbose?: boolean) => {
|
|
294
|
+
spec: OpenApiObject;
|
|
295
|
+
loc: number;
|
|
296
|
+
}[];
|
|
297
|
+
|
|
298
|
+
declare const commentsToOpenApi: (fileContents: string, verbose?: boolean) => {
|
|
299
|
+
spec: OpenApiObject;
|
|
300
|
+
loc: number;
|
|
301
|
+
}[];
|
|
302
|
+
|
|
303
|
+
export { BaseDefinition, OpenApiObject, SpecBuilder, SwaggerCompilerPlugin, commentsToOpenApi$1 as jsDocumentCommentsToOpenApi, parseFile, commentsToOpenApi as swaggerJsDocumentCommentsToOpenApi, yamlLoc };
|