@trapi/swagger 0.3.5 → 0.3.7
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/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +13 -13
- package/dist/metadata.js.map +1 -1
- package/dist/specification/abstract.d.ts +1 -1
- package/dist/specification/abstract.d.ts.map +1 -1
- package/dist/specification/abstract.js +12 -12
- package/dist/specification/abstract.js.map +1 -1
- package/dist/specification/v2/index.d.ts +2 -23
- package/dist/specification/v2/index.d.ts.map +1 -1
- package/dist/specification/v2/index.js +17 -383
- package/dist/specification/v2/index.js.map +1 -1
- package/dist/specification/v2/module.d.ts +24 -0
- package/dist/specification/v2/module.d.ts.map +1 -0
- package/dist/specification/v2/module.js +389 -0
- package/dist/specification/v2/module.js.map +1 -0
- package/dist/specification/v3/index.d.ts +2 -24
- package/dist/specification/v3/index.d.ts.map +1 -1
- package/dist/specification/v3/index.js +17 -369
- package/dist/specification/v3/index.js.map +1 -1
- package/dist/specification/v3/module.d.ts +25 -0
- package/dist/specification/v3/module.d.ts.map +1 -0
- package/dist/specification/v3/module.js +377 -0
- package/dist/specification/v3/module.js.map +1 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +11 -13
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -24
- package/dist/config/index.js.map +0 -1
- package/dist/config/utils/index.d.ts +0 -2
- package/dist/config/utils/index.d.ts.map +0 -1
- package/dist/config/utils/index.js +0 -24
- package/dist/config/utils/index.js.map +0 -1
- package/dist/config/utils/validator.d.ts +0 -5
- package/dist/config/utils/validator.d.ts.map +0 -1
- package/dist/config/utils/validator.js +0 -85
- package/dist/config/utils/validator.js.map +0 -1
- package/dist/utils/yup.d.ts +0 -5
- package/dist/utils/yup.d.ts.map +0 -1
- package/dist/utils/yup.js +0 -17
- package/dist/utils/yup.js.map +0 -1
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Version3SpecGenerator = void 0;
|
|
10
|
+
const decorators_1 = require("@trapi/decorators");
|
|
11
|
+
const url_1 = require("url");
|
|
12
|
+
const smob_1 = require("smob");
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
14
|
+
const utils_2 = require("../utils");
|
|
15
|
+
const abstract_1 = require("../abstract");
|
|
16
|
+
class Version3SpecGenerator extends abstract_1.AbstractSpecGenerator {
|
|
17
|
+
getSwaggerSpec() {
|
|
18
|
+
return this.build();
|
|
19
|
+
}
|
|
20
|
+
build() {
|
|
21
|
+
if (typeof this.spec !== 'undefined') {
|
|
22
|
+
return this.spec;
|
|
23
|
+
}
|
|
24
|
+
let spec = {
|
|
25
|
+
components: this.buildComponents(),
|
|
26
|
+
info: this.buildInfo(),
|
|
27
|
+
openapi: '3.0.0',
|
|
28
|
+
paths: this.buildPaths(),
|
|
29
|
+
servers: this.buildServers(),
|
|
30
|
+
tags: [],
|
|
31
|
+
};
|
|
32
|
+
if (this.config.specificationExtra) {
|
|
33
|
+
spec = (0, smob_1.merge)(spec, this.config.specificationExtra);
|
|
34
|
+
}
|
|
35
|
+
return spec;
|
|
36
|
+
}
|
|
37
|
+
buildComponents() {
|
|
38
|
+
const components = {
|
|
39
|
+
examples: {},
|
|
40
|
+
headers: {},
|
|
41
|
+
parameters: {},
|
|
42
|
+
requestBodies: {},
|
|
43
|
+
responses: {},
|
|
44
|
+
schemas: this.buildSchema(),
|
|
45
|
+
securitySchemes: {},
|
|
46
|
+
};
|
|
47
|
+
if (this.config.securityDefinitions) {
|
|
48
|
+
components.securitySchemes = Version3SpecGenerator.translateSecurityDefinitions(this.config.securityDefinitions);
|
|
49
|
+
}
|
|
50
|
+
return components;
|
|
51
|
+
}
|
|
52
|
+
static translateSecurityDefinitions(securityDefinitions) {
|
|
53
|
+
const security = {};
|
|
54
|
+
// tslint:disable-next-line:forin
|
|
55
|
+
const keys = Object.keys(securityDefinitions);
|
|
56
|
+
for (let i = 0; i < keys.length; i++) {
|
|
57
|
+
const securityDefinition = securityDefinitions[keys[i]];
|
|
58
|
+
switch (securityDefinition.type) {
|
|
59
|
+
case 'http':
|
|
60
|
+
security[keys[i]] = securityDefinition;
|
|
61
|
+
break;
|
|
62
|
+
case 'oauth2':
|
|
63
|
+
security[keys[i]] = securityDefinition;
|
|
64
|
+
break;
|
|
65
|
+
case 'apiKey':
|
|
66
|
+
security[keys[i]] = securityDefinition;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return security;
|
|
71
|
+
}
|
|
72
|
+
buildPaths() {
|
|
73
|
+
const paths = {};
|
|
74
|
+
this.metadata.controllers.forEach((controller) => {
|
|
75
|
+
// construct documentation using all methods except @Hidden
|
|
76
|
+
controller.methods
|
|
77
|
+
.filter((method) => !method.hidden)
|
|
78
|
+
.forEach((method) => {
|
|
79
|
+
let path = (0, utils_2.removeFinalCharacter)((0, utils_2.removeRepeatingCharacter)(`/${controller.path}/${method.path}`, '/'), '/');
|
|
80
|
+
path = (0, utils_1.normalizePathParameters)(path);
|
|
81
|
+
paths[path] = paths[path] || {};
|
|
82
|
+
this.buildMethod(controller.name, method, paths[path]);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return paths;
|
|
86
|
+
}
|
|
87
|
+
buildMethod(controllerName, method, pathObject) {
|
|
88
|
+
const operation = this.buildOperation(controllerName, method);
|
|
89
|
+
if (typeof pathObject === 'object') {
|
|
90
|
+
pathObject[method.method] = operation;
|
|
91
|
+
}
|
|
92
|
+
const pathMethod = operation;
|
|
93
|
+
pathMethod.description = method.description;
|
|
94
|
+
pathMethod.summary = method.summary;
|
|
95
|
+
pathMethod.tags = method.tags;
|
|
96
|
+
// Use operationId tag otherwise fallback to generated. Warning: This doesn't check uniqueness.
|
|
97
|
+
pathMethod.operationId = method.operationId || pathMethod.operationId;
|
|
98
|
+
if (method.deprecated) {
|
|
99
|
+
pathMethod.deprecated = method.deprecated;
|
|
100
|
+
}
|
|
101
|
+
if (method.security) {
|
|
102
|
+
pathMethod.security = method.security;
|
|
103
|
+
}
|
|
104
|
+
const bodyParams = method.parameters.filter((p) => p.in === 'body');
|
|
105
|
+
const formParams = method.parameters.filter((p) => p.in === 'formData');
|
|
106
|
+
pathMethod.parameters = method.parameters
|
|
107
|
+
.filter((p) => ['body', 'formData', 'request', 'body-prop', 'res'].indexOf(p.in) === -1)
|
|
108
|
+
.map((p) => this.buildParameter(p));
|
|
109
|
+
if (bodyParams.length > 1) {
|
|
110
|
+
throw new Error('Only one body parameter allowed per controller method.');
|
|
111
|
+
}
|
|
112
|
+
if (bodyParams.length > 0 && formParams.length > 0) {
|
|
113
|
+
throw new Error('Either body parameter or form parameters allowed per controller method - not both.');
|
|
114
|
+
}
|
|
115
|
+
if (bodyParams.length > 0) {
|
|
116
|
+
pathMethod.requestBody = this.buildRequestBody(bodyParams[0]);
|
|
117
|
+
}
|
|
118
|
+
else if (formParams.length > 0) {
|
|
119
|
+
pathMethod.requestBody = this.buildRequestBodyWithFormData(formParams);
|
|
120
|
+
}
|
|
121
|
+
for (let i = 0; i < method.extensions.length; i++) {
|
|
122
|
+
pathMethod[method.extensions[i].key] = method.extensions[i].value;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
buildRequestBodyWithFormData(parameters) {
|
|
126
|
+
const required = [];
|
|
127
|
+
const properties = {};
|
|
128
|
+
const keys = Object.keys(parameters);
|
|
129
|
+
for (let i = 0; i < parameters.length; i++) {
|
|
130
|
+
const mediaType = this.buildMediaType(parameters[keys[i]]);
|
|
131
|
+
properties[parameters[keys[i]].name] = mediaType.schema;
|
|
132
|
+
if (parameters[keys[i]].required) {
|
|
133
|
+
required.push(parameters[keys[i]].name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
required: required.length > 0,
|
|
138
|
+
content: {
|
|
139
|
+
'multipart/form-data': {
|
|
140
|
+
schema: Object.assign({ type: 'object', properties }, (required && required.length && { required })),
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
buildRequestBody(parameter) {
|
|
146
|
+
const mediaType = this.buildMediaType(parameter);
|
|
147
|
+
return {
|
|
148
|
+
description: parameter.description,
|
|
149
|
+
required: parameter.required,
|
|
150
|
+
content: {
|
|
151
|
+
'application/json': mediaType,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
buildMediaType(parameter) {
|
|
156
|
+
const mediaType = {
|
|
157
|
+
schema: this.getSwaggerType(parameter.type),
|
|
158
|
+
};
|
|
159
|
+
this.buildFromParameterExamples(mediaType, parameter);
|
|
160
|
+
return mediaType;
|
|
161
|
+
}
|
|
162
|
+
buildOperation(controllerName, method) {
|
|
163
|
+
const swaggerResponses = {};
|
|
164
|
+
method.responses.forEach((res) => {
|
|
165
|
+
var _a;
|
|
166
|
+
const name = (_a = res.status) !== null && _a !== void 0 ? _a : 'default';
|
|
167
|
+
// no string key
|
|
168
|
+
swaggerResponses[name] = {
|
|
169
|
+
description: res.description,
|
|
170
|
+
};
|
|
171
|
+
if (res.schema && !(0, decorators_1.isVoidType)(res.schema)) {
|
|
172
|
+
const contentKey = 'application/json';
|
|
173
|
+
swaggerResponses[name].content = {
|
|
174
|
+
[contentKey]: {
|
|
175
|
+
schema: this.getSwaggerType(res.schema),
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
if (res.examples) {
|
|
179
|
+
swaggerResponses[name].content[contentKey].examples = {
|
|
180
|
+
default: {
|
|
181
|
+
value: res.examples,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (res.headers) {
|
|
187
|
+
const headers = {};
|
|
188
|
+
if (res.headers.typeName === 'refObject') {
|
|
189
|
+
headers[res.headers.refName] = {
|
|
190
|
+
schema: this.getSwaggerTypeForReferenceType(res.headers),
|
|
191
|
+
description: res.headers.description,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
else if (res.headers.typeName === 'nestedObjectLiteral') {
|
|
195
|
+
res.headers.properties.forEach((each) => {
|
|
196
|
+
headers[each.name] = {
|
|
197
|
+
schema: this.getSwaggerType(each.type),
|
|
198
|
+
description: each.description,
|
|
199
|
+
required: each.required,
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
swaggerResponses[res.name].headers = headers;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
operationId: this.getOperationId(method.name),
|
|
208
|
+
responses: swaggerResponses,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
buildParameter(source) {
|
|
212
|
+
const parameter = {
|
|
213
|
+
description: source.description,
|
|
214
|
+
in: source.in,
|
|
215
|
+
name: source.name,
|
|
216
|
+
required: source.required,
|
|
217
|
+
schema: {
|
|
218
|
+
default: source.default,
|
|
219
|
+
format: undefined,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
if (source.deprecated) {
|
|
223
|
+
parameter.deprecated = true;
|
|
224
|
+
}
|
|
225
|
+
const parameterType = this.getSwaggerType(source.type);
|
|
226
|
+
if (parameterType.format) {
|
|
227
|
+
parameter.schema.format = parameterType.format;
|
|
228
|
+
}
|
|
229
|
+
if ((0, utils_1.hasOwnProperty)(parameterType, '$ref') &&
|
|
230
|
+
parameterType.$ref) {
|
|
231
|
+
parameter.schema = parameterType;
|
|
232
|
+
return parameter;
|
|
233
|
+
}
|
|
234
|
+
if (source.type.typeName === 'any') {
|
|
235
|
+
parameter.schema.type = 'string';
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
if (parameterType.type) {
|
|
239
|
+
parameter.schema.type = parameterType.type;
|
|
240
|
+
}
|
|
241
|
+
parameter.schema.items = parameterType.items;
|
|
242
|
+
parameter.schema.enum = parameterType.enum;
|
|
243
|
+
}
|
|
244
|
+
this.buildFromParameterExamples(parameter, source);
|
|
245
|
+
return parameter;
|
|
246
|
+
}
|
|
247
|
+
buildFromParameterExamples(parameter, sourceParameter) {
|
|
248
|
+
if ((Array.isArray(sourceParameter.example) && sourceParameter.example.length === 1) ||
|
|
249
|
+
typeof sourceParameter.example === 'undefined') {
|
|
250
|
+
parameter.example = Array.isArray(sourceParameter.example) &&
|
|
251
|
+
sourceParameter.example.length === 1 ?
|
|
252
|
+
sourceParameter.example[0] :
|
|
253
|
+
undefined;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
parameter.examples = {};
|
|
257
|
+
sourceParameter.example.forEach((example, index) => Object.assign(parameter.examples, {
|
|
258
|
+
[`Example ${index + 1}`]: { value: example },
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
return parameter;
|
|
262
|
+
}
|
|
263
|
+
buildServers() {
|
|
264
|
+
const url = new url_1.URL(this.config.host || 'http://localhost:3000/');
|
|
265
|
+
let host = (url.host + url.pathname).replace(/([^:]\/)\/+/g, '$1');
|
|
266
|
+
host = host.substr(-1, 1) === '/' ? host.substr(0, host.length - 1) : host;
|
|
267
|
+
return [
|
|
268
|
+
{
|
|
269
|
+
url: host,
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
buildSchema() {
|
|
274
|
+
const schema = {};
|
|
275
|
+
Object.keys(this.metadata.referenceTypes).map((typeName) => {
|
|
276
|
+
const referenceType = this.metadata.referenceTypes[typeName];
|
|
277
|
+
if (referenceType.typeName === 'refObject') {
|
|
278
|
+
const required = referenceType.properties.filter((p) => p.required).map((p) => p.name);
|
|
279
|
+
schema[referenceType.refName] = {
|
|
280
|
+
description: referenceType.description,
|
|
281
|
+
properties: this.buildProperties(referenceType.properties),
|
|
282
|
+
required: required && required.length > 0 ? Array.from(new Set(required)) : undefined,
|
|
283
|
+
type: 'object',
|
|
284
|
+
};
|
|
285
|
+
if (referenceType.additionalProperties) {
|
|
286
|
+
schema[referenceType.refName].additionalProperties = this.getSwaggerType(referenceType.additionalProperties);
|
|
287
|
+
}
|
|
288
|
+
if (referenceType.example) {
|
|
289
|
+
schema[referenceType.refName].example = referenceType.example;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else if (referenceType.typeName === 'refEnum') {
|
|
293
|
+
const enumTypes = this.determineTypesUsedInEnum(referenceType.members);
|
|
294
|
+
if (enumTypes.size === 1) {
|
|
295
|
+
schema[referenceType.refName] = {
|
|
296
|
+
description: referenceType.description,
|
|
297
|
+
enum: referenceType.members,
|
|
298
|
+
type: enumTypes.has('string') ? 'string' : 'number',
|
|
299
|
+
};
|
|
300
|
+
if (referenceType.memberNames !== undefined && referenceType.members.length === referenceType.memberNames.length) {
|
|
301
|
+
schema[referenceType.refName]['x-enum-varnames'] = referenceType.memberNames;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
schema[referenceType.refName] = {
|
|
306
|
+
description: referenceType.description,
|
|
307
|
+
anyOf: [
|
|
308
|
+
{
|
|
309
|
+
type: 'number',
|
|
310
|
+
enum: referenceType.members.filter((e) => typeof e === 'number'),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
type: 'string',
|
|
314
|
+
enum: referenceType.members.filter((e) => typeof e === 'string'),
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else if (referenceType.typeName === 'refAlias') {
|
|
321
|
+
const swaggerType = this.getSwaggerType(referenceType.type);
|
|
322
|
+
const format = referenceType.format;
|
|
323
|
+
const validators = Object.keys(referenceType.validators)
|
|
324
|
+
.filter((key) => !key.startsWith('is') && key !== 'minDate' && key !== 'maxDate')
|
|
325
|
+
.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: referenceType.validators[key].value })), {});
|
|
326
|
+
schema[referenceType.refName] = Object.assign(Object.assign(Object.assign({}, swaggerType), { default: referenceType.default || swaggerType.default, example: referenceType.example, format: format || swaggerType.format, description: referenceType.description }), validators);
|
|
327
|
+
}
|
|
328
|
+
if (referenceType.deprecated) {
|
|
329
|
+
schema[referenceType.refName].deprecated = true;
|
|
330
|
+
}
|
|
331
|
+
return typeName;
|
|
332
|
+
});
|
|
333
|
+
return schema;
|
|
334
|
+
}
|
|
335
|
+
getSwaggerTypeForIntersectionType(type) {
|
|
336
|
+
return { allOf: type.members.map((x) => this.getSwaggerType(x)) };
|
|
337
|
+
}
|
|
338
|
+
buildProperties(properties) {
|
|
339
|
+
const result = {};
|
|
340
|
+
properties.forEach((property) => {
|
|
341
|
+
const swaggerType = this.getSwaggerType(property.type);
|
|
342
|
+
const format = property.format;
|
|
343
|
+
swaggerType.description = property.description;
|
|
344
|
+
swaggerType.example = property.example;
|
|
345
|
+
swaggerType.format = format || swaggerType.format;
|
|
346
|
+
if (!swaggerType.$ref) {
|
|
347
|
+
swaggerType.default = property.default;
|
|
348
|
+
}
|
|
349
|
+
if (property.deprecated) {
|
|
350
|
+
swaggerType.deprecated = true;
|
|
351
|
+
}
|
|
352
|
+
result[property.name] = swaggerType;
|
|
353
|
+
});
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
getSwaggerTypeForEnumType(enumType) {
|
|
357
|
+
const types = this.determineTypesUsedInEnum(enumType.members);
|
|
358
|
+
if (types.size === 1) {
|
|
359
|
+
const type = types.values().next().value;
|
|
360
|
+
const nullable = !!enumType.members.includes(null);
|
|
361
|
+
return {
|
|
362
|
+
type,
|
|
363
|
+
enum: enumType.members.map((member) => (member === null ? null : String(member))),
|
|
364
|
+
nullable,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
const valuesDelimited = Array.from(types).join(',');
|
|
368
|
+
throw new Error(`Enums can only have string or number values, but enum had ${valuesDelimited}`);
|
|
369
|
+
}
|
|
370
|
+
getSwaggerTypeForReferenceType(referenceType) {
|
|
371
|
+
return {
|
|
372
|
+
$ref: `#/components/schemas/${referenceType.refName}`,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
exports.Version3SpecGenerator = Version3SpecGenerator;
|
|
377
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/specification/v3/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,kDAG2B;AAC3B,6BAA0B;AAI1B,+BAA6B;AAC7B,uCAAsE;AAGtE,oCAA0E;AAC1E,0CAAoD;AAEpD,MAAa,qBAAsB,SAAQ,gCAAmE;IACnG,cAAc;QACjB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEM,KAAK;QACR,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE;YAClC,OAAO,IAAI,CAAC,IAAI,CAAC;SACpB;QAED,IAAI,IAAI,GAAyB;YAC7B,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE;YAClC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;YACtB,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;YACxB,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE;YAC5B,IAAI,EAAE,EAAE;SACX,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAChC,IAAI,GAAG,IAAA,YAAK,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,C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ES,8BAA8B,CAAC,aAA4B;QACjE,OAAO;YACH,IAAI,EAAE,wBAAwB,aAAa,CAAC,OAAO,EAAE;SACxD,CAAC;IACN,CAAC;CACJ;AAjcD,sDAicC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -23,5 +23,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
__exportStar(require("./path"), exports);
|
|
24
24
|
__exportStar(require("./object"), exports);
|
|
25
25
|
__exportStar(require("./package-json"), exports);
|
|
26
|
-
__exportStar(require("./yup"), exports);
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,2CAAyB;AACzB,iDAA+B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,2CAAyB;AACzB,iDAA+B"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/tada5hi"
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.7",
|
|
10
10
|
"description": "Generate Swagger files from a decorator APIs.",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"typescript",
|
|
@@ -35,17 +35,19 @@
|
|
|
35
35
|
"preblushOnly": "npm run build"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@trapi/decorators": "^0.1.0",
|
|
39
|
+
"@trapi/metadata": "^0.4.0",
|
|
38
40
|
"@types/yamljs": "^0.2.31",
|
|
39
|
-
"@types/yup": "^0.32.0",
|
|
40
41
|
"jest": "^27.5.1",
|
|
41
42
|
"rimraf": "^3.0.2"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
45
|
+
"smob": "^0.0.6",
|
|
46
|
+
"yamljs": "^0.3.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@trapi/decorators": ">=0.0.0 <1.0.0",
|
|
50
|
+
"@trapi/metadata": ">=0.3.0 <1.0.0"
|
|
49
51
|
},
|
|
50
52
|
"repository": {
|
|
51
53
|
"type": "git",
|
|
@@ -56,16 +58,12 @@
|
|
|
56
58
|
"url": "https://github.com/Tada5hi/trapi/issues"
|
|
57
59
|
},
|
|
58
60
|
"homepage": "https://github.com/Tada5hi/trapi#readme",
|
|
59
|
-
"directories": {
|
|
60
|
-
"lib": "dist",
|
|
61
|
-
"doc": "doc"
|
|
62
|
-
},
|
|
63
61
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
62
|
+
"node": ">=16.0.0"
|
|
65
63
|
},
|
|
66
64
|
"publishConfig": {
|
|
67
65
|
"access": "public"
|
|
68
66
|
},
|
|
69
67
|
"engineStrict": true,
|
|
70
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "cf4d5975d8057cae096f2f2d3ddd6fe062ebcf01"
|
|
71
69
|
}
|
package/dist/config/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC"}
|
package/dist/config/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./utils"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,0CAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/utils/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./validator"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SchemaOf } from 'yup';
|
|
2
|
-
import { Specification } from '../../specification';
|
|
3
|
-
export declare function useConfigValidator(): SchemaOf<Specification.Config>;
|
|
4
|
-
export declare function extendSwaggerConfig(workingDir: string, conf: Specification.Config): Specification.Config;
|
|
5
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/config/utils/validator.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,QAAQ,EACX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKpD,wBAAgB,kBAAkB,IAAK,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAqEpE;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAQxG"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.extendSwaggerConfig = exports.useConfigValidator = void 0;
|
|
10
|
-
const yup_1 = require("yup");
|
|
11
|
-
const specification_1 = require("../../specification");
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
let validatorInstance;
|
|
14
|
-
function useConfigValidator() {
|
|
15
|
-
if (typeof validatorInstance !== 'undefined') {
|
|
16
|
-
return validatorInstance;
|
|
17
|
-
}
|
|
18
|
-
const securityDefinitionsValidator = (0, yup_1.lazy)((map) => {
|
|
19
|
-
if (Object.prototype.toString.call(map) === '[object Object]') {
|
|
20
|
-
const directory = (0, utils_1.mapYupRuleToDictionary)(map, (0, yup_1.object)({
|
|
21
|
-
type: (0, yup_1.mixed)().oneOf(['apiKey', 'oauth2', 'http']),
|
|
22
|
-
description: (0, yup_1.string)().optional().default(undefined),
|
|
23
|
-
schema: (0, yup_1.mixed)().oneOf(['basic']).optional(),
|
|
24
|
-
in: (0, yup_1.mixed)().oneOf(['query', 'header']),
|
|
25
|
-
flows: (0, yup_1.object)({
|
|
26
|
-
implicit: (0, yup_1.object)({
|
|
27
|
-
refreshUrl: (0, yup_1.string)().optional().default(undefined),
|
|
28
|
-
scopes: (0, yup_1.mixed)().optional().default({}),
|
|
29
|
-
authorizationUrl: (0, yup_1.string)(),
|
|
30
|
-
}).optional(),
|
|
31
|
-
password: (0, yup_1.object)({
|
|
32
|
-
refreshUrl: (0, yup_1.string)().optional().default(undefined),
|
|
33
|
-
scopes: (0, yup_1.mixed)().optional().default({}),
|
|
34
|
-
tokenUrl: (0, yup_1.string)(),
|
|
35
|
-
}).optional(),
|
|
36
|
-
authorizationCode: (0, yup_1.object)({
|
|
37
|
-
refreshUrl: (0, yup_1.string)().optional().default(undefined),
|
|
38
|
-
scopes: (0, yup_1.mixed)().optional().default({}),
|
|
39
|
-
authorizationUrl: (0, yup_1.string)(),
|
|
40
|
-
tokenUrl: (0, yup_1.string)(),
|
|
41
|
-
}).optional(),
|
|
42
|
-
clientCredentials: (0, yup_1.object)({
|
|
43
|
-
refreshUrl: (0, yup_1.string)().optional().default(undefined),
|
|
44
|
-
scopes: (0, yup_1.mixed)().optional().default({}),
|
|
45
|
-
tokenUrl: (0, yup_1.string)(),
|
|
46
|
-
}),
|
|
47
|
-
}).optional().default(undefined),
|
|
48
|
-
}));
|
|
49
|
-
return (0, yup_1.object)(directory).default({});
|
|
50
|
-
}
|
|
51
|
-
return (0, yup_1.object)().optional().default({});
|
|
52
|
-
});
|
|
53
|
-
validatorInstance = (0, yup_1.object)({
|
|
54
|
-
yaml: (0, yup_1.boolean)().optional().default(false),
|
|
55
|
-
outputDirectory: (0, yup_1.string)().optional().default(undefined),
|
|
56
|
-
outputFileName: (0, yup_1.string)().optional().default(undefined),
|
|
57
|
-
specification: ((0, yup_1.string)().oneOf([
|
|
58
|
-
specification_1.Specification.SpecificationOption.V2,
|
|
59
|
-
specification_1.Specification.SpecificationOption.V3,
|
|
60
|
-
]).optional().default(specification_1.Specification.SpecificationOption.V2)),
|
|
61
|
-
specificationExtra: (0, yup_1.mixed)().optional().default(undefined),
|
|
62
|
-
host: (0, yup_1.string)().optional().default(undefined),
|
|
63
|
-
version: (0, yup_1.string)().optional().default(undefined),
|
|
64
|
-
name: (0, yup_1.string)().optional().default(undefined),
|
|
65
|
-
description: (0, yup_1.string)().optional().default(undefined),
|
|
66
|
-
license: (0, yup_1.string)().optional().default(undefined),
|
|
67
|
-
basePath: (0, yup_1.string)().optional().default(undefined),
|
|
68
|
-
securityDefinitions: securityDefinitionsValidator,
|
|
69
|
-
consumes: (0, yup_1.array)().of((0, yup_1.string)()).optional().default(undefined),
|
|
70
|
-
produces: (0, yup_1.array)().of((0, yup_1.string)()).optional().default(undefined),
|
|
71
|
-
collectionFormat: (0, yup_1.string)().optional().default(undefined),
|
|
72
|
-
});
|
|
73
|
-
return validatorInstance;
|
|
74
|
-
}
|
|
75
|
-
exports.useConfigValidator = useConfigValidator;
|
|
76
|
-
function extendSwaggerConfig(workingDir, conf) {
|
|
77
|
-
conf.version = conf.version || (0, utils_1.getPackageJsonStringValue)(workingDir, 'version', '0.0.1');
|
|
78
|
-
conf.name = conf.name || (0, utils_1.getPackageJsonStringValue)(workingDir, 'name');
|
|
79
|
-
conf.description = conf.description || (0, utils_1.getPackageJsonStringValue)(workingDir, 'description');
|
|
80
|
-
conf.license = conf.license || (0, utils_1.getPackageJsonStringValue)(workingDir, 'license', 'MIT');
|
|
81
|
-
conf.specification = specification_1.Specification.SpecificationOption[conf.specification] || specification_1.Specification.SpecificationOption.V2;
|
|
82
|
-
return conf;
|
|
83
|
-
}
|
|
84
|
-
exports.extendSwaggerConfig = extendSwaggerConfig;
|
|
85
|
-
//# sourceMappingURL=validator.js.map
|