@trapi/swagger 0.3.7 → 1.0.0-alpha.10
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/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +25 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/type.d.ts +83 -0
- package/dist/config/type.d.ts.map +1 -0
- package/dist/config/type.js +9 -0
- package/dist/config/type.js.map +1 -0
- package/dist/config/utils.d.ts +3 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +54 -0
- package/dist/config/utils.js.map +1 -0
- package/dist/constants.d.ts +15 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +27 -0
- package/dist/constants.js.map +1 -0
- package/dist/generator/abstract.d.ts +29 -0
- package/dist/generator/abstract.d.ts.map +1 -0
- package/dist/generator/abstract.js +215 -0
- package/dist/generator/abstract.js.map +1 -0
- package/dist/{specification → generator}/index.d.ts +0 -2
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/{specification → generator}/index.js +1 -3
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/module.d.ts +14 -0
- package/dist/generator/module.d.ts.map +1 -0
- package/dist/generator/module.js +35 -0
- package/dist/generator/module.js.map +1 -0
- package/dist/generator/v2/index.d.ts +2 -0
- package/dist/generator/v2/index.d.ts.map +1 -0
- package/dist/{specification/utils → generator/v2}/index.js +2 -2
- package/dist/generator/v2/index.js.map +1 -0
- package/dist/generator/v2/module.d.ts +27 -0
- package/dist/generator/v2/module.d.ts.map +1 -0
- package/dist/generator/v2/module.js +517 -0
- package/dist/generator/v2/module.js.map +1 -0
- package/dist/generator/v3/index.d.ts +2 -0
- package/dist/generator/v3/index.d.ts.map +1 -0
- package/dist/generator/v3/index.js +24 -0
- package/dist/generator/v3/index.js.map +1 -0
- package/dist/generator/v3/module.d.ts +31 -0
- package/dist/generator/v3/module.d.ts.map +1 -0
- package/dist/generator/v3/module.js +508 -0
- package/dist/generator/v3/module.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +3 -4
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +3 -15
- package/dist/metadata.js.map +1 -1
- package/dist/schema/constants.d.ts +7 -0
- package/dist/schema/constants.d.ts.map +1 -0
- package/dist/schema/constants.js +17 -0
- package/dist/schema/constants.js.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +27 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/type.d.ts +140 -0
- package/dist/schema/type.d.ts.map +1 -0
- package/dist/schema/type.js.map +1 -0
- package/dist/schema/v2/constants.d.ts +8 -0
- package/dist/schema/v2/constants.d.ts.map +1 -0
- package/dist/schema/v2/constants.js +18 -0
- package/dist/schema/v2/constants.js.map +1 -0
- package/dist/schema/v2/index.d.ts +3 -0
- package/dist/schema/v2/index.d.ts.map +1 -0
- package/dist/{specification/v3 → schema/v2}/index.js +1 -1
- package/dist/schema/v2/index.js.map +1 -0
- package/dist/schema/v2/type.d.ts +116 -0
- package/dist/schema/v2/type.d.ts.map +1 -0
- package/dist/schema/v2/type.js.map +1 -0
- package/dist/schema/v3/constants.d.ts +7 -0
- package/dist/schema/v3/constants.d.ts.map +1 -0
- package/dist/schema/v3/constants.js +17 -0
- package/dist/schema/v3/constants.js.map +1 -0
- package/dist/schema/v3/index.d.ts +3 -0
- package/dist/schema/v3/index.d.ts.map +1 -0
- package/dist/{specification/v2 → schema/v3}/index.js +1 -1
- package/dist/schema/v3/index.js.map +1 -0
- package/dist/schema/v3/type.d.ts +158 -0
- package/dist/schema/v3/type.d.ts.map +1 -0
- package/dist/schema/v3/type.js +9 -0
- package/dist/schema/v3/type.js.map +1 -0
- package/dist/type.d.ts +44 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/character.d.ts +3 -0
- package/dist/utils/character.d.ts.map +1 -0
- package/dist/{specification/utils → utils}/character.js +4 -5
- package/dist/utils/character.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -0
- package/dist/utils/object.js.map +1 -1
- package/dist/utils/value.d.ts +2 -0
- package/dist/utils/value.d.ts.map +1 -0
- package/dist/utils/value.js +26 -0
- package/dist/utils/value.js.map +1 -0
- package/package.json +7 -10
- package/dist/module.d.ts +0 -8
- package/dist/module.d.ts.map +0 -1
- package/dist/module.js +0 -31
- package/dist/module.js.map +0 -1
- package/dist/specification/abstract.d.ts +0 -29
- package/dist/specification/abstract.d.ts.map +0 -1
- package/dist/specification/abstract.js +0 -226
- package/dist/specification/abstract.js.map +0 -1
- package/dist/specification/index.d.ts.map +0 -1
- package/dist/specification/index.js.map +0 -1
- package/dist/specification/module.d.ts +0 -5
- package/dist/specification/module.d.ts.map +0 -1
- package/dist/specification/module.js +0 -29
- package/dist/specification/module.js.map +0 -1
- package/dist/specification/type.d.ts +0 -268
- package/dist/specification/type.d.ts.map +0 -1
- package/dist/specification/type.js +0 -18
- package/dist/specification/type.js.map +0 -1
- package/dist/specification/utils/character.d.ts +0 -3
- package/dist/specification/utils/character.d.ts.map +0 -1
- package/dist/specification/utils/character.js.map +0 -1
- package/dist/specification/utils/index.d.ts +0 -2
- package/dist/specification/utils/index.d.ts.map +0 -1
- package/dist/specification/utils/index.js.map +0 -1
- package/dist/specification/v2/index.d.ts +0 -3
- package/dist/specification/v2/index.d.ts.map +0 -1
- package/dist/specification/v2/index.js.map +0 -1
- package/dist/specification/v2/module.d.ts +0 -24
- package/dist/specification/v2/module.d.ts.map +0 -1
- package/dist/specification/v2/module.js +0 -389
- package/dist/specification/v2/module.js.map +0 -1
- package/dist/specification/v2/type.d.ts +0 -79
- package/dist/specification/v2/type.d.ts.map +0 -1
- package/dist/specification/v2/type.js.map +0 -1
- package/dist/specification/v3/index.d.ts +0 -3
- package/dist/specification/v3/index.d.ts.map +0 -1
- package/dist/specification/v3/index.js.map +0 -1
- package/dist/specification/v3/module.d.ts +0 -25
- package/dist/specification/v3/module.d.ts.map +0 -1
- package/dist/specification/v3/module.js +0 -377
- package/dist/specification/v3/module.js.map +0 -1
- package/dist/specification/v3/type.d.ts +0 -121
- package/dist/specification/v3/type.d.ts.map +0 -1
- package/dist/specification/v3/type.js.map +0 -1
- package/dist/utils/package-json.d.ts +0 -3
- package/dist/utils/package-json.d.ts.map +0 -1
- package/dist/utils/package-json.js +0 -35
- package/dist/utils/package-json.js.map +0 -1
- /package/dist/{specification/v2 → schema}/type.js +0 -0
- /package/dist/{specification/v3 → schema/v2}/type.js +0 -0
|
@@ -1,389 +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.Version2SpecGenerator = void 0;
|
|
10
|
-
const decorators_1 = require("@trapi/decorators");
|
|
11
|
-
const smob_1 = require("smob");
|
|
12
|
-
const path_1 = require("path");
|
|
13
|
-
const url_1 = require("url");
|
|
14
|
-
const utils_1 = require("../../utils");
|
|
15
|
-
const abstract_1 = require("../abstract");
|
|
16
|
-
class Version2SpecGenerator 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
|
-
basePath: this.config.basePath,
|
|
26
|
-
definitions: this.buildDefinitions(),
|
|
27
|
-
info: this.buildInfo(),
|
|
28
|
-
paths: this.buildPaths(),
|
|
29
|
-
swagger: '2.0',
|
|
30
|
-
};
|
|
31
|
-
spec.securityDefinitions = this.config.securityDefinitions ?
|
|
32
|
-
Version2SpecGenerator.translateSecurityDefinitions(this.config.securityDefinitions) :
|
|
33
|
-
{};
|
|
34
|
-
if (this.config.consumes) {
|
|
35
|
-
spec.consumes = this.config.consumes;
|
|
36
|
-
}
|
|
37
|
-
if (this.config.produces) {
|
|
38
|
-
spec.produces = this.config.produces;
|
|
39
|
-
}
|
|
40
|
-
if (this.config.host) {
|
|
41
|
-
const url = new url_1.URL(this.config.host);
|
|
42
|
-
let host = (url.host + url.pathname).replace(/([^:]\/)\/+/g, '$1');
|
|
43
|
-
host = host.substr(-1, 1) === '/' ? host.substr(0, host.length - 1) : host;
|
|
44
|
-
spec.host = host;
|
|
45
|
-
}
|
|
46
|
-
if (this.config.specificationExtra) {
|
|
47
|
-
spec = (0, smob_1.merge)(spec, this.config.specificationExtra);
|
|
48
|
-
}
|
|
49
|
-
this.spec = spec;
|
|
50
|
-
return spec;
|
|
51
|
-
}
|
|
52
|
-
static translateSecurityDefinitions(securityDefinitions) {
|
|
53
|
-
const definitions = {};
|
|
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
|
-
if (securityDefinition.schema === 'basic') {
|
|
61
|
-
definitions[keys[i]] = {
|
|
62
|
-
type: 'basic',
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case 'apiKey':
|
|
67
|
-
definitions[keys[i]] = securityDefinition;
|
|
68
|
-
break;
|
|
69
|
-
case 'oauth2':
|
|
70
|
-
if (securityDefinition.flows.implicit) {
|
|
71
|
-
definitions[`${keys[i]}Implicit`] = {
|
|
72
|
-
type: 'oauth2',
|
|
73
|
-
flow: 'implicit',
|
|
74
|
-
authorizationUrl: securityDefinition.flows.implicit.authorizationUrl,
|
|
75
|
-
scopes: securityDefinition.flows.implicit.scopes,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (securityDefinition.flows.password) {
|
|
79
|
-
definitions[`${keys[i]}Implicit`] = {
|
|
80
|
-
type: 'oauth2',
|
|
81
|
-
flow: 'password',
|
|
82
|
-
tokenUrl: securityDefinition.flows.password.tokenUrl,
|
|
83
|
-
scopes: securityDefinition.flows.password.scopes,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
if (securityDefinition.flows.authorizationCode) {
|
|
87
|
-
definitions[`${keys[i]}AccessCode`] = {
|
|
88
|
-
type: 'oauth2',
|
|
89
|
-
flow: 'accessCode',
|
|
90
|
-
tokenUrl: securityDefinition.flows.authorizationCode.tokenUrl,
|
|
91
|
-
authorizationUrl: securityDefinition.flows.authorizationCode.authorizationUrl,
|
|
92
|
-
scopes: securityDefinition.flows.authorizationCode.scopes,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
if (securityDefinition.flows.clientCredentials) {
|
|
96
|
-
definitions[`${keys[i]}Application`] = {
|
|
97
|
-
type: 'oauth2',
|
|
98
|
-
flow: 'application',
|
|
99
|
-
tokenUrl: securityDefinition.flows.clientCredentials.tokenUrl,
|
|
100
|
-
scopes: securityDefinition.flows.clientCredentials.scopes,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return definitions;
|
|
107
|
-
}
|
|
108
|
-
/*
|
|
109
|
-
Definitions ( + utils)
|
|
110
|
-
*/
|
|
111
|
-
buildDefinitions() {
|
|
112
|
-
const definitions = {};
|
|
113
|
-
Object.keys(this.metadata.referenceTypes).map((typeName) => {
|
|
114
|
-
const referenceType = this.metadata.referenceTypes[typeName];
|
|
115
|
-
// const key : string = referenceType.typeName.replace('_', '');
|
|
116
|
-
if ((0, decorators_1.isRefObjectType)(referenceType)) {
|
|
117
|
-
const required = referenceType.properties
|
|
118
|
-
.filter((p) => p.required).map((p) => p.name);
|
|
119
|
-
definitions[referenceType.refName] = {
|
|
120
|
-
description: referenceType.description,
|
|
121
|
-
properties: this.buildProperties(referenceType.properties),
|
|
122
|
-
required: required && required.length > 0 ? Array.from(new Set(required)) : undefined,
|
|
123
|
-
type: 'object',
|
|
124
|
-
};
|
|
125
|
-
if (referenceType.additionalProperties) {
|
|
126
|
-
definitions[referenceType.refName].additionalProperties = true;
|
|
127
|
-
}
|
|
128
|
-
if (referenceType.example) {
|
|
129
|
-
definitions[referenceType.refName].example = referenceType.example;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else if ((0, decorators_1.isRefEnumType)(referenceType)) {
|
|
133
|
-
definitions[referenceType.refName] = {
|
|
134
|
-
description: referenceType.description,
|
|
135
|
-
enum: referenceType.members,
|
|
136
|
-
type: this.decideEnumType(referenceType.members, referenceType.refName),
|
|
137
|
-
};
|
|
138
|
-
if (referenceType.memberNames !== undefined && referenceType.members.length === referenceType.memberNames.length) {
|
|
139
|
-
definitions[referenceType.refName]['x-enum-varnames'] = referenceType.memberNames;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if ((0, decorators_1.isRefAliasType)(referenceType)) {
|
|
143
|
-
const swaggerType = this.getSwaggerType(referenceType.type);
|
|
144
|
-
const format = referenceType.format;
|
|
145
|
-
const validators = Object.keys(referenceType.validators)
|
|
146
|
-
.filter((key) => !key.startsWith('is') && key !== 'minDate' && key !== 'maxDate')
|
|
147
|
-
.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: referenceType.validators[key].value })), {});
|
|
148
|
-
definitions[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);
|
|
149
|
-
}
|
|
150
|
-
return typeName;
|
|
151
|
-
});
|
|
152
|
-
return definitions;
|
|
153
|
-
}
|
|
154
|
-
decideEnumType(anEnum, nameOfEnum) {
|
|
155
|
-
const typesUsedInEnum = this.determineTypesUsedInEnum(anEnum);
|
|
156
|
-
const badEnumErrorMessage = () => {
|
|
157
|
-
const valuesDelimited = Array.from(typesUsedInEnum).join(',');
|
|
158
|
-
return `Enums can only have string or number values, but enum ${nameOfEnum} had ${valuesDelimited}`;
|
|
159
|
-
};
|
|
160
|
-
let enumTypeForSwagger = 'string';
|
|
161
|
-
if (typesUsedInEnum.has('string') && typesUsedInEnum.size === 1) {
|
|
162
|
-
enumTypeForSwagger = 'string';
|
|
163
|
-
}
|
|
164
|
-
else if (typesUsedInEnum.has('number') && typesUsedInEnum.size === 1) {
|
|
165
|
-
enumTypeForSwagger = 'number';
|
|
166
|
-
}
|
|
167
|
-
else if (typesUsedInEnum.size === 2 && typesUsedInEnum.has('number') && typesUsedInEnum.has('string')) {
|
|
168
|
-
enumTypeForSwagger = 'string';
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
throw new Error(badEnumErrorMessage());
|
|
172
|
-
}
|
|
173
|
-
return enumTypeForSwagger;
|
|
174
|
-
}
|
|
175
|
-
/*
|
|
176
|
-
Path & Parameter ( + utils)
|
|
177
|
-
*/
|
|
178
|
-
buildPaths() {
|
|
179
|
-
const paths = {};
|
|
180
|
-
const unique = (input) => [...new Set(input)];
|
|
181
|
-
this.metadata.controllers.forEach((controller) => {
|
|
182
|
-
controller.methods.forEach((method) => {
|
|
183
|
-
let fullPath = path_1.posix.join('/', (controller.path ? controller.path : ''), method.path);
|
|
184
|
-
fullPath = (0, utils_1.normalizePathParameters)(fullPath);
|
|
185
|
-
paths[fullPath] = paths[fullPath] || {};
|
|
186
|
-
method.consumes = unique([...controller.consumes, ...method.consumes]);
|
|
187
|
-
method.produces = unique([...controller.produces, ...method.produces]);
|
|
188
|
-
method.tags = unique([...controller.tags, ...method.tags]);
|
|
189
|
-
method.security = method.security || controller.security;
|
|
190
|
-
// todo: unique for objects
|
|
191
|
-
method.responses = unique([...controller.responses, ...method.responses]);
|
|
192
|
-
const pathObject = paths[fullPath];
|
|
193
|
-
pathObject[method.method] = this.buildPathMethod(controller.name, method);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
return paths;
|
|
197
|
-
}
|
|
198
|
-
buildPathMethod(controllerName, method) {
|
|
199
|
-
const pathMethod = this.buildOperation(method);
|
|
200
|
-
pathMethod.description = method.description;
|
|
201
|
-
if (method.summary) {
|
|
202
|
-
pathMethod.summary = method.summary;
|
|
203
|
-
}
|
|
204
|
-
if (method.deprecated) {
|
|
205
|
-
pathMethod.deprecated = method.deprecated;
|
|
206
|
-
}
|
|
207
|
-
if (method.tags.length) {
|
|
208
|
-
pathMethod.tags = method.tags;
|
|
209
|
-
}
|
|
210
|
-
if (method.security) {
|
|
211
|
-
pathMethod.security = method.security.map((s) => ({
|
|
212
|
-
[s.name]: s.scopes || [],
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
this.handleMethodConsumes(method, pathMethod);
|
|
216
|
-
pathMethod.parameters = method.parameters
|
|
217
|
-
.filter((p) => (p.in !== 'param'))
|
|
218
|
-
.map((p) => this.buildParameter(p));
|
|
219
|
-
method.parameters
|
|
220
|
-
.filter((p) => (p.in === 'param'))
|
|
221
|
-
.forEach((p) => {
|
|
222
|
-
pathMethod.parameters.push(this.buildParameter({
|
|
223
|
-
description: p.description,
|
|
224
|
-
in: 'query',
|
|
225
|
-
name: p.name,
|
|
226
|
-
parameterName: p.parameterName,
|
|
227
|
-
required: false,
|
|
228
|
-
type: p.type,
|
|
229
|
-
}));
|
|
230
|
-
pathMethod.parameters.push(this.buildParameter({
|
|
231
|
-
description: p.description,
|
|
232
|
-
in: 'formData',
|
|
233
|
-
name: p.name,
|
|
234
|
-
parameterName: p.parameterName,
|
|
235
|
-
required: false,
|
|
236
|
-
type: p.type,
|
|
237
|
-
}));
|
|
238
|
-
});
|
|
239
|
-
if (pathMethod.parameters.filter((p) => p.in === 'body').length > 1) {
|
|
240
|
-
throw new Error('Only one body parameter allowed per controller method.');
|
|
241
|
-
}
|
|
242
|
-
return pathMethod;
|
|
243
|
-
}
|
|
244
|
-
buildParameter(parameter) {
|
|
245
|
-
const swaggerParameter = {
|
|
246
|
-
description: parameter.description,
|
|
247
|
-
in: parameter.in,
|
|
248
|
-
name: parameter.name,
|
|
249
|
-
required: parameter.required,
|
|
250
|
-
};
|
|
251
|
-
const parameterType = this.getSwaggerType(parameter.type);
|
|
252
|
-
if (((0, utils_1.hasOwnProperty)(parameterType, '$ref') && parameterType.$ref) || parameter.in === 'body') {
|
|
253
|
-
swaggerParameter.schema = parameterType;
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
swaggerParameter.type = parameterType.type;
|
|
257
|
-
if (parameterType.items) {
|
|
258
|
-
swaggerParameter.items = parameterType.items;
|
|
259
|
-
if (parameter.collectionFormat || this.config.collectionFormat) {
|
|
260
|
-
swaggerParameter.collectionFormat = parameter.collectionFormat || this.config.collectionFormat;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
if (parameterType.format) {
|
|
265
|
-
swaggerParameter.format = parameterType.format;
|
|
266
|
-
}
|
|
267
|
-
if (parameter.default !== undefined) {
|
|
268
|
-
swaggerParameter.default = parameter.default;
|
|
269
|
-
}
|
|
270
|
-
if (parameterType.enum) {
|
|
271
|
-
swaggerParameter.enum = parameterType.enum;
|
|
272
|
-
}
|
|
273
|
-
return swaggerParameter;
|
|
274
|
-
}
|
|
275
|
-
handleMethodConsumes(method, pathMethod) {
|
|
276
|
-
if (method.consumes.length) {
|
|
277
|
-
pathMethod.consumes = method.consumes;
|
|
278
|
-
}
|
|
279
|
-
if ((!pathMethod.consumes || !pathMethod.consumes.length)) {
|
|
280
|
-
if (method.parameters.some((p) => (p.in === 'formData' && p.type.typeName === 'file'))) {
|
|
281
|
-
pathMethod.consumes = pathMethod.consumes || [];
|
|
282
|
-
pathMethod.consumes.push('multipart/form-data');
|
|
283
|
-
}
|
|
284
|
-
else if (this.hasFormParams(method)) {
|
|
285
|
-
pathMethod.consumes = pathMethod.consumes || [];
|
|
286
|
-
pathMethod.consumes.push('application/x-www-form-urlencoded');
|
|
287
|
-
}
|
|
288
|
-
else if (this.supportsBodyParameters(method.method)) {
|
|
289
|
-
pathMethod.consumes = pathMethod.consumes || [];
|
|
290
|
-
pathMethod.consumes.push('application/json');
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
hasFormParams(method) {
|
|
295
|
-
return method.parameters.find((p) => (p.in === 'formData'));
|
|
296
|
-
}
|
|
297
|
-
supportsBodyParameters(method) {
|
|
298
|
-
return ['post', 'put', 'patch'].some((m) => m === method);
|
|
299
|
-
}
|
|
300
|
-
/*
|
|
301
|
-
Swagger Type ( + utils)
|
|
302
|
-
*/
|
|
303
|
-
getSwaggerTypeForEnumType(enumType) {
|
|
304
|
-
const types = this.determineTypesUsedInEnum(enumType.members);
|
|
305
|
-
if (types.size === 1) {
|
|
306
|
-
const type = types.values().next().value;
|
|
307
|
-
const nullable = !!enumType.members.includes(null);
|
|
308
|
-
return { type, enum: enumType.members.map((member) => (member === null ? null : String(member))), 'x-nullable': nullable };
|
|
309
|
-
}
|
|
310
|
-
const valuesDelimited = Array.from(types).join(',');
|
|
311
|
-
throw new Error(`Enums can only have string or number values, but enum had ${valuesDelimited}`);
|
|
312
|
-
}
|
|
313
|
-
getSwaggerTypeForIntersectionType(type) {
|
|
314
|
-
// tslint:disable-next-line:no-shadowed-variable
|
|
315
|
-
const properties = type.members.reduce((acc, type) => {
|
|
316
|
-
if (type.typeName === 'refObject') {
|
|
317
|
-
let refType = type;
|
|
318
|
-
refType = this.metadata.referenceTypes[refType.refName];
|
|
319
|
-
const props = refType &&
|
|
320
|
-
refType.properties &&
|
|
321
|
-
refType.properties.reduce((pAcc, prop) => (Object.assign(Object.assign({}, pAcc), { [prop.name]: this.getSwaggerType(prop.type) })), {});
|
|
322
|
-
return Object.assign(Object.assign({}, acc), props);
|
|
323
|
-
}
|
|
324
|
-
return Object.assign({}, acc);
|
|
325
|
-
}, {});
|
|
326
|
-
return { type: 'object', properties };
|
|
327
|
-
}
|
|
328
|
-
getSwaggerTypeForReferenceType(referenceType) {
|
|
329
|
-
return { $ref: `#/definitions/${referenceType.refName}` };
|
|
330
|
-
}
|
|
331
|
-
buildProperties(properties) {
|
|
332
|
-
const swaggerProperties = {};
|
|
333
|
-
properties.forEach((property) => {
|
|
334
|
-
const swaggerType = this.getSwaggerType(property.type);
|
|
335
|
-
if (!(0, utils_1.hasOwnProperty)(swaggerType, '$ref') || !swaggerType.$ref) {
|
|
336
|
-
swaggerType.description = property.description;
|
|
337
|
-
}
|
|
338
|
-
swaggerProperties[property.name] = swaggerType;
|
|
339
|
-
});
|
|
340
|
-
return swaggerProperties;
|
|
341
|
-
}
|
|
342
|
-
buildOperation(method) {
|
|
343
|
-
const operation = {
|
|
344
|
-
operationId: this.getOperationId(method.name),
|
|
345
|
-
produces: [],
|
|
346
|
-
responses: {},
|
|
347
|
-
};
|
|
348
|
-
const methodReturnTypes = new Set();
|
|
349
|
-
method.responses.forEach((res) => {
|
|
350
|
-
operation.responses[res.status] = {
|
|
351
|
-
description: res.description,
|
|
352
|
-
};
|
|
353
|
-
if (res.schema) {
|
|
354
|
-
const swaggerType = this.getSwaggerType(res.schema);
|
|
355
|
-
if (swaggerType.type !== 'void') {
|
|
356
|
-
operation.responses[res.status].schema = swaggerType;
|
|
357
|
-
}
|
|
358
|
-
methodReturnTypes.add(this.getMimeType(swaggerType));
|
|
359
|
-
}
|
|
360
|
-
if (res.examples) {
|
|
361
|
-
operation.responses[res.status].examples = { 'application/json': res.examples };
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
this.handleMethodProduces(method, operation, methodReturnTypes);
|
|
365
|
-
return operation;
|
|
366
|
-
}
|
|
367
|
-
getMimeType(swaggerType) {
|
|
368
|
-
if (swaggerType.$ref ||
|
|
369
|
-
swaggerType.type === 'array' ||
|
|
370
|
-
swaggerType.type === 'object') {
|
|
371
|
-
return 'application/json';
|
|
372
|
-
}
|
|
373
|
-
if (swaggerType.type === 'string' &&
|
|
374
|
-
swaggerType.format === 'binary') {
|
|
375
|
-
return 'application/octet-stream';
|
|
376
|
-
}
|
|
377
|
-
return 'text/html';
|
|
378
|
-
}
|
|
379
|
-
handleMethodProduces(method, operation, methodReturnTypes) {
|
|
380
|
-
if (method.produces.length) {
|
|
381
|
-
operation.produces = method.produces;
|
|
382
|
-
}
|
|
383
|
-
else if (methodReturnTypes && methodReturnTypes.size > 0) {
|
|
384
|
-
operation.produces = Array.from(methodReturnTypes);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
exports.Version2SpecGenerator = Version2SpecGenerator;
|
|
389
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/specification/v2/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,kDAO2B;AAC3B,+BAA6B;AAC7B,+BAA6B;AAC7B,6BAA0B;AAK1B,uCAAsE;AAItE,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,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,UAAU,E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AiB,CAAC,CAAC;QAChE,OAAO,SAAS,CAAC;IACrB,CAAC;IAEO,WAAW,CAAC,WAAmC;QACnD,IACI,WAAW,CAAC,IAAI;YAChB,WAAW,CAAC,IAAI,KAAK,OAAO;YAC5B,WAAW,CAAC,IAAI,KAAK,QAAQ,EAC/B;YACE,OAAO,kBAAkB,CAAC;SAC7B;QAAC,IACE,WAAW,CAAC,IAAI,KAAK,QAAQ;YAC7B,WAAW,CAAC,MAAM,KAAK,QAAQ,EACjC;YACE,OAAO,0BAA0B,CAAC;SACrC;QACD,OAAO,WAAW,CAAC;IACvB,CAAC;IAEO,oBAAoB,CAAC,MAAc,EAAE,SAAc,EAAE,iBAA8B;QACvF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;YACxB,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SACxC;aAAM,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,EAAE;YACxD,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACtD;IACL,CAAC;CACJ;AApbD,sDAobC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Specification } from '../type';
|
|
2
|
-
export declare namespace SpecificationV2 {
|
|
3
|
-
interface Spec extends Specification.BaseSpec {
|
|
4
|
-
swagger: '2.0';
|
|
5
|
-
host?: string;
|
|
6
|
-
basePath?: string;
|
|
7
|
-
schemes?: string[];
|
|
8
|
-
consumes?: string[];
|
|
9
|
-
produces?: string[];
|
|
10
|
-
paths: {
|
|
11
|
-
[pathName: string]: Specification.Path<Operation, Response>;
|
|
12
|
-
};
|
|
13
|
-
definitions?: {
|
|
14
|
-
[definitionsName: string]: Schema;
|
|
15
|
-
};
|
|
16
|
-
parameters?: {
|
|
17
|
-
[parameterName: string]: Schema | Specification.QueryParameter<Schema>;
|
|
18
|
-
};
|
|
19
|
-
responses?: {
|
|
20
|
-
[responseName: string]: Response;
|
|
21
|
-
};
|
|
22
|
-
security?: Security[];
|
|
23
|
-
securityDefinitions?: {
|
|
24
|
-
[name: string]: Security;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
type Parameter = Omit<Specification.Parameter<Schema> & {
|
|
28
|
-
'x-deprecated'?: boolean;
|
|
29
|
-
}, 'deprecated'>;
|
|
30
|
-
interface Operation extends Specification.BaseOperation<Parameter, Response, Security> {
|
|
31
|
-
produces?: [string];
|
|
32
|
-
}
|
|
33
|
-
interface Response extends Specification.BaseResponse {
|
|
34
|
-
schema?: Schema;
|
|
35
|
-
headers?: {
|
|
36
|
-
[headerName: string]: Header;
|
|
37
|
-
};
|
|
38
|
-
examples?: {
|
|
39
|
-
[exampleName: string]: Specification.Example;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
interface Header {
|
|
43
|
-
type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
44
|
-
}
|
|
45
|
-
interface Schema extends Specification.BaseSchema<Schema> {
|
|
46
|
-
['x-nullable']?: boolean;
|
|
47
|
-
['x-deprecated']?: boolean;
|
|
48
|
-
}
|
|
49
|
-
interface BasicSecurity extends Specification.BaseSecurity {
|
|
50
|
-
type: 'basic';
|
|
51
|
-
}
|
|
52
|
-
interface BaseOAuthSecurity extends Specification.BaseSecurity {
|
|
53
|
-
type: 'oauth2';
|
|
54
|
-
}
|
|
55
|
-
interface OAuth2ImplicitSecurity extends BaseOAuthSecurity {
|
|
56
|
-
flow: 'implicit';
|
|
57
|
-
authorizationUrl: string;
|
|
58
|
-
scopes?: Record<string, string>;
|
|
59
|
-
}
|
|
60
|
-
interface OAuth2PasswordSecurity extends BaseOAuthSecurity {
|
|
61
|
-
flow: 'password';
|
|
62
|
-
tokenUrl: string;
|
|
63
|
-
scopes?: Record<string, string>;
|
|
64
|
-
}
|
|
65
|
-
interface OAuth2ApplicationSecurity extends BaseOAuthSecurity {
|
|
66
|
-
flow: 'application';
|
|
67
|
-
tokenUrl: string;
|
|
68
|
-
scopes?: Record<string, string>;
|
|
69
|
-
}
|
|
70
|
-
interface OAuth2AccessCodeSecurity extends BaseOAuthSecurity {
|
|
71
|
-
flow: 'accessCode';
|
|
72
|
-
tokenUrl: string;
|
|
73
|
-
authorizationUrl: string;
|
|
74
|
-
scopes?: Record<string, string>;
|
|
75
|
-
}
|
|
76
|
-
type OAuth2Security = OAuth2AccessCodeSecurity | OAuth2ApplicationSecurity | OAuth2ImplicitSecurity | OAuth2PasswordSecurity;
|
|
77
|
-
type Security = BasicSecurity | OAuth2Security | Specification.ApiKeySecurity;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/specification/v2/type.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,aAAa,EAChB,MAAM,SAAS,CAAC;AAEjB,yBAAiB,eAAe,CAAC;IAC7B,UAAiB,IAAK,SAAQ,aAAa,CAAC,QAAQ;QAChD,OAAO,EAAE,KAAK,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,KAAK,EAAE;YAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;SAAE,CAAC;QACvE,WAAW,CAAC,EAAE;YAAE,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QACpD,UAAU,CAAC,EAAE;YAAE,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;SAAE,CAAC;QACxF,SAAS,CAAC,EAAE;YAA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D,IAAI,EAAE,UAAU,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAED,UAAiB,sBAAuB,SAAQ,iBAAiB;QAC7D,IAAI,EAAE,UAAU,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAED,UAAiB,yBAA0B,SAAQ,iBAAiB;QAChE,IAAI,EAAE,aAAa,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAED,UAAiB,wBAAyB,SAAQ,iBAAiB;QAC/D,IAAI,EAAE,YAAY,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAED,KAAY,cAAc,GAAG,wBAAwB,GACrD,yBAAyB,GACzB,sBAAsB,GACtB,sBAAsB,CAAC;IAEvB,KAAY,QAAQ,GAChB,aAAa,GACb,cAAc,GACd,aAAa,CAAC,cAAc,CAAC;CACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/specification/v2/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/specification/v3/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/specification/v3/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { EnumType, IntersectionType, ReferenceType, ResolverProperty } from '@trapi/decorators';
|
|
2
|
-
import { Method } from '@trapi/metadata';
|
|
3
|
-
import { SpecificationV3 } from './type';
|
|
4
|
-
import { AbstractSpecGenerator } from '../abstract';
|
|
5
|
-
export declare class Version3SpecGenerator extends AbstractSpecGenerator<SpecificationV3.Spec, SpecificationV3.Schema> {
|
|
6
|
-
getSwaggerSpec(): SpecificationV3.Spec;
|
|
7
|
-
build(): SpecificationV3.Spec;
|
|
8
|
-
private buildComponents;
|
|
9
|
-
private static translateSecurityDefinitions;
|
|
10
|
-
private buildPaths;
|
|
11
|
-
private buildMethod;
|
|
12
|
-
private buildRequestBodyWithFormData;
|
|
13
|
-
private buildRequestBody;
|
|
14
|
-
private buildMediaType;
|
|
15
|
-
protected buildOperation(controllerName: string, method: Method): SpecificationV3.Operation;
|
|
16
|
-
private buildParameter;
|
|
17
|
-
private buildFromParameterExamples;
|
|
18
|
-
private buildServers;
|
|
19
|
-
private buildSchema;
|
|
20
|
-
protected getSwaggerTypeForIntersectionType(type: IntersectionType): SpecificationV3.Schema;
|
|
21
|
-
protected buildProperties<T>(properties: ResolverProperty[]): Record<string, SpecificationV3.Schema>;
|
|
22
|
-
protected getSwaggerTypeForEnumType(enumType: EnumType): SpecificationV3.Schema;
|
|
23
|
-
protected getSwaggerTypeForReferenceType(referenceType: ReferenceType): SpecificationV3.Schema;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/specification/v3/module.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,QAAQ,EACR,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EACpD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,MAAM,EACT,M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