@tsoa-next/cli 7.1.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.
Files changed (122) hide show
  1. package/README.MD +3 -0
  2. package/dist/cli.d.ts +44 -0
  3. package/dist/cli.js +356 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.js +25 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/metadataGeneration/controllerGenerator.d.ts +30 -0
  9. package/dist/metadataGeneration/controllerGenerator.js +229 -0
  10. package/dist/metadataGeneration/controllerGenerator.js.map +1 -0
  11. package/dist/metadataGeneration/exceptions.d.ts +13 -0
  12. package/dist/metadataGeneration/exceptions.js +53 -0
  13. package/dist/metadataGeneration/exceptions.js.map +1 -0
  14. package/dist/metadataGeneration/extension.d.ts +5 -0
  15. package/dist/metadataGeneration/extension.js +85 -0
  16. package/dist/metadataGeneration/extension.js.map +1 -0
  17. package/dist/metadataGeneration/initializer-value.d.ts +6 -0
  18. package/dist/metadataGeneration/initializer-value.js +154 -0
  19. package/dist/metadataGeneration/initializer-value.js.map +1 -0
  20. package/dist/metadataGeneration/metadataGenerator.d.ts +29 -0
  21. package/dist/metadataGeneration/metadataGenerator.js +220 -0
  22. package/dist/metadataGeneration/metadataGenerator.js.map +1 -0
  23. package/dist/metadataGeneration/methodGenerator.d.ts +45 -0
  24. package/dist/metadataGeneration/methodGenerator.js +367 -0
  25. package/dist/metadataGeneration/methodGenerator.js.map +1 -0
  26. package/dist/metadataGeneration/parameterGenerator.d.ts +33 -0
  27. package/dist/metadataGeneration/parameterGenerator.js +552 -0
  28. package/dist/metadataGeneration/parameterGenerator.js.map +1 -0
  29. package/dist/metadataGeneration/transformer/dateTransformer.d.ts +6 -0
  30. package/dist/metadataGeneration/transformer/dateTransformer.js +28 -0
  31. package/dist/metadataGeneration/transformer/dateTransformer.js.map +1 -0
  32. package/dist/metadataGeneration/transformer/enumTransformer.d.ts +12 -0
  33. package/dist/metadataGeneration/transformer/enumTransformer.js +75 -0
  34. package/dist/metadataGeneration/transformer/enumTransformer.js.map +1 -0
  35. package/dist/metadataGeneration/transformer/primitiveTransformer.d.ts +11 -0
  36. package/dist/metadataGeneration/transformer/primitiveTransformer.js +70 -0
  37. package/dist/metadataGeneration/transformer/primitiveTransformer.js.map +1 -0
  38. package/dist/metadataGeneration/transformer/propertyTransformer.d.ts +12 -0
  39. package/dist/metadataGeneration/transformer/propertyTransformer.js +101 -0
  40. package/dist/metadataGeneration/transformer/propertyTransformer.js.map +1 -0
  41. package/dist/metadataGeneration/transformer/referenceTransformer.d.ts +10 -0
  42. package/dist/metadataGeneration/transformer/referenceTransformer.js +81 -0
  43. package/dist/metadataGeneration/transformer/referenceTransformer.js.map +1 -0
  44. package/dist/metadataGeneration/transformer/transformer.d.ts +9 -0
  45. package/dist/metadataGeneration/transformer/transformer.js +39 -0
  46. package/dist/metadataGeneration/transformer/transformer.js.map +1 -0
  47. package/dist/metadataGeneration/typeResolver.d.ts +52 -0
  48. package/dist/metadataGeneration/typeResolver.js +1202 -0
  49. package/dist/metadataGeneration/typeResolver.js.map +1 -0
  50. package/dist/module/generate-routes.d.ts +9 -0
  51. package/dist/module/generate-routes.js +90 -0
  52. package/dist/module/generate-routes.js.map +1 -0
  53. package/dist/module/generate-spec.d.ts +9 -0
  54. package/dist/module/generate-spec.js +79 -0
  55. package/dist/module/generate-spec.js.map +1 -0
  56. package/dist/routeGeneration/defaultRouteGenerator.d.ts +12 -0
  57. package/dist/routeGeneration/defaultRouteGenerator.js +119 -0
  58. package/dist/routeGeneration/defaultRouteGenerator.js.map +1 -0
  59. package/dist/routeGeneration/routeGenerator.d.ts +56 -0
  60. package/dist/routeGeneration/routeGenerator.js +257 -0
  61. package/dist/routeGeneration/routeGenerator.js.map +1 -0
  62. package/dist/routeGeneration/templates/express.hbs +221 -0
  63. package/dist/routeGeneration/templates/hapi.hbs +267 -0
  64. package/dist/routeGeneration/templates/koa.hbs +218 -0
  65. package/dist/swagger/specGenerator.d.ts +33 -0
  66. package/dist/swagger/specGenerator.js +253 -0
  67. package/dist/swagger/specGenerator.js.map +1 -0
  68. package/dist/swagger/specGenerator2.d.ts +27 -0
  69. package/dist/swagger/specGenerator2.js +476 -0
  70. package/dist/swagger/specGenerator2.js.map +1 -0
  71. package/dist/swagger/specGenerator3.d.ts +158 -0
  72. package/dist/swagger/specGenerator3.js +646 -0
  73. package/dist/swagger/specGenerator3.js.map +1 -0
  74. package/dist/swagger/specGenerator31.d.ts +24 -0
  75. package/dist/swagger/specGenerator31.js +75 -0
  76. package/dist/swagger/specGenerator31.js.map +1 -0
  77. package/dist/utils/decoratorUtils.d.ts +9 -0
  78. package/dist/utils/decoratorUtils.js +118 -0
  79. package/dist/utils/decoratorUtils.js.map +1 -0
  80. package/dist/utils/flowUtils.d.ts +1 -0
  81. package/dist/utils/flowUtils.js +8 -0
  82. package/dist/utils/flowUtils.js.map +1 -0
  83. package/dist/utils/fs.d.ts +5 -0
  84. package/dist/utils/fs.js +55 -0
  85. package/dist/utils/fs.js.map +1 -0
  86. package/dist/utils/genericTypeGuards.d.ts +1 -0
  87. package/dist/utils/genericTypeGuards.js +8 -0
  88. package/dist/utils/genericTypeGuards.js.map +1 -0
  89. package/dist/utils/headerTypeHelpers.d.ts +5 -0
  90. package/dist/utils/headerTypeHelpers.js +27 -0
  91. package/dist/utils/headerTypeHelpers.js.map +1 -0
  92. package/dist/utils/importClassesFromDirectories.d.ts +4 -0
  93. package/dist/utils/importClassesFromDirectories.js +20 -0
  94. package/dist/utils/importClassesFromDirectories.js.map +1 -0
  95. package/dist/utils/internalTypeGuards.d.ts +5 -0
  96. package/dist/utils/internalTypeGuards.js +66 -0
  97. package/dist/utils/internalTypeGuards.js.map +1 -0
  98. package/dist/utils/isVoidType.d.ts +2 -0
  99. package/dist/utils/isVoidType.js +16 -0
  100. package/dist/utils/isVoidType.js.map +1 -0
  101. package/dist/utils/jsDocUtils.d.ts +8 -0
  102. package/dist/utils/jsDocUtils.js +122 -0
  103. package/dist/utils/jsDocUtils.js.map +1 -0
  104. package/dist/utils/jsonUtils.d.ts +1 -0
  105. package/dist/utils/jsonUtils.js +12 -0
  106. package/dist/utils/jsonUtils.js.map +1 -0
  107. package/dist/utils/pathUtils.d.ts +9 -0
  108. package/dist/utils/pathUtils.js +37 -0
  109. package/dist/utils/pathUtils.js.map +1 -0
  110. package/dist/utils/specMerge.d.ts +2 -0
  111. package/dist/utils/specMerge.js +36 -0
  112. package/dist/utils/specMerge.js.map +1 -0
  113. package/dist/utils/swaggerUtils.d.ts +3 -0
  114. package/dist/utils/swaggerUtils.js +22 -0
  115. package/dist/utils/swaggerUtils.js.map +1 -0
  116. package/dist/utils/unspecifiedObject.d.ts +3 -0
  117. package/dist/utils/unspecifiedObject.js +3 -0
  118. package/dist/utils/unspecifiedObject.js.map +1 -0
  119. package/dist/utils/validatorUtils.d.ts +5 -0
  120. package/dist/utils/validatorUtils.js +241 -0
  121. package/dist/utils/validatorUtils.js.map +1 -0
  122. package/package.json +69 -0
@@ -0,0 +1,476 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpecGenerator2 = void 0;
4
+ const ts_deepmerge_1 = require("ts-deepmerge");
5
+ const runtime_1 = require("@tsoa-next/runtime");
6
+ const specGenerator_1 = require("./specGenerator");
7
+ const isVoidType_1 = require("../utils/isVoidType");
8
+ const pathUtils_1 = require("../utils/pathUtils");
9
+ const specMerge_1 = require("../utils/specMerge");
10
+ const swaggerUtils_1 = require("../utils/swaggerUtils");
11
+ const validatorUtils_1 = require("../utils/validatorUtils");
12
+ class SpecGenerator2 extends specGenerator_1.SpecGenerator {
13
+ metadata;
14
+ config;
15
+ constructor(metadata, config) {
16
+ super(metadata, config);
17
+ this.metadata = metadata;
18
+ this.config = config;
19
+ }
20
+ GetSpec() {
21
+ let spec = {
22
+ basePath: (0, pathUtils_1.normalisePath)(this.config.basePath, '/', undefined, false),
23
+ consumes: [swaggerUtils_1.DEFAULT_REQUEST_MEDIA_TYPE],
24
+ definitions: this.buildDefinitions(),
25
+ info: {
26
+ title: '',
27
+ },
28
+ paths: this.buildPaths(),
29
+ produces: [swaggerUtils_1.DEFAULT_RESPONSE_MEDIA_TYPE],
30
+ swagger: '2.0',
31
+ };
32
+ const securityDefinitions = this.config.securityDefinitions ? this.config.securityDefinitions : {};
33
+ const supportedSchemes = ['basic', 'apiKey', 'oauth2'];
34
+ for (const { type } of Object.values(securityDefinitions)) {
35
+ if (!supportedSchemes.includes(type)) {
36
+ throw new Error(`Swagger 2.0 does not support "${type}" security scheme (allowed values: ${supportedSchemes.join(',')})`);
37
+ }
38
+ }
39
+ spec.securityDefinitions = securityDefinitions;
40
+ if (this.config.name) {
41
+ spec.info.title = this.config.name;
42
+ }
43
+ if (this.config.version) {
44
+ spec.info.version = this.config.version;
45
+ }
46
+ if (this.config.host) {
47
+ spec.host = this.config.host;
48
+ }
49
+ if (this.config.description) {
50
+ spec.info.description = this.config.description;
51
+ }
52
+ if (this.config.termsOfService) {
53
+ spec.info.termsOfService = this.config.termsOfService;
54
+ }
55
+ if (this.config.tags) {
56
+ spec.tags = this.config.tags;
57
+ }
58
+ if (this.config.license) {
59
+ spec.info.license = { name: this.config.license };
60
+ }
61
+ if (this.config.contact) {
62
+ spec.info.contact = this.config.contact;
63
+ }
64
+ if (this.config.spec) {
65
+ this.config.specMerging = this.config.specMerging || 'immediate';
66
+ const mergeFuncs = {
67
+ immediate: Object.assign,
68
+ recursive: specMerge_1.recursiveMerge,
69
+ deepmerge: (spec, merge) => (0, ts_deepmerge_1.merge)(spec, merge),
70
+ };
71
+ spec = mergeFuncs[this.config.specMerging](spec, this.config.spec);
72
+ }
73
+ if (this.config.schemes) {
74
+ spec.schemes = this.config.schemes;
75
+ }
76
+ return spec;
77
+ }
78
+ buildDefinitions() {
79
+ const definitions = {};
80
+ Object.keys(this.metadata.referenceTypeMap).map(typeName => {
81
+ const referenceType = this.metadata.referenceTypeMap[typeName];
82
+ if (referenceType.dataType === 'refObject') {
83
+ const required = referenceType.properties.filter(p => this.isRequiredWithoutDefault(p) && !this.hasUndefined(p)).map(p => p.name);
84
+ definitions[referenceType.refName] = {
85
+ description: referenceType.description,
86
+ properties: this.buildProperties(referenceType.properties),
87
+ required: required && required.length > 0 ? Array.from(new Set(required)) : undefined,
88
+ type: 'object',
89
+ };
90
+ if (referenceType.additionalProperties) {
91
+ definitions[referenceType.refName].additionalProperties = this.buildAdditionalProperties(referenceType.additionalProperties);
92
+ }
93
+ else {
94
+ // Since additionalProperties was not explicitly set in the TypeScript interface for this model
95
+ // ...we need to make a decision
96
+ definitions[referenceType.refName].additionalProperties = this.determineImplicitAdditionalPropertiesValue();
97
+ }
98
+ if (referenceType.example) {
99
+ definitions[referenceType.refName].example = referenceType.example;
100
+ }
101
+ if (referenceType.title) {
102
+ definitions[referenceType.refName].title = referenceType.title;
103
+ }
104
+ }
105
+ else if (referenceType.dataType === 'refEnum') {
106
+ definitions[referenceType.refName] = {
107
+ description: referenceType.description,
108
+ enum: referenceType.enums,
109
+ type: this.decideEnumType(referenceType.enums, referenceType.refName),
110
+ };
111
+ if (this.config.xEnumVarnames && referenceType.enumVarnames !== undefined && referenceType.enums.length === referenceType.enumVarnames.length) {
112
+ definitions[referenceType.refName]['x-enum-varnames'] = referenceType.enumVarnames;
113
+ }
114
+ if (referenceType.example) {
115
+ definitions[referenceType.refName].example = referenceType.example;
116
+ }
117
+ if (referenceType.title) {
118
+ definitions[referenceType.refName].title = referenceType.title;
119
+ }
120
+ }
121
+ else if (referenceType.dataType === 'refAlias') {
122
+ const swaggerType = this.getSwaggerType(referenceType.type);
123
+ const format = referenceType.format;
124
+ const validators = Object.keys(referenceType.validators)
125
+ .filter(validatorUtils_1.shouldIncludeValidatorInSchema)
126
+ .reduce((acc, key) => {
127
+ return {
128
+ ...acc,
129
+ [key]: referenceType.validators[key].value,
130
+ };
131
+ }, {});
132
+ definitions[referenceType.refName] = {
133
+ ...swaggerType,
134
+ default: referenceType.default || swaggerType.default,
135
+ example: referenceType.example,
136
+ format: format || swaggerType.format,
137
+ description: referenceType.description,
138
+ ...(referenceType.title && { title: referenceType.title }),
139
+ ...validators,
140
+ };
141
+ }
142
+ else {
143
+ (0, runtime_1.assertNever)(referenceType);
144
+ }
145
+ if (referenceType.deprecated) {
146
+ definitions[referenceType.refName]['x-deprecated'] = true;
147
+ }
148
+ });
149
+ return definitions;
150
+ }
151
+ buildPaths() {
152
+ const paths = {};
153
+ this.metadata.controllers.forEach(controller => {
154
+ const normalisedControllerPath = (0, pathUtils_1.normalisePath)(controller.path, '/');
155
+ // construct documentation using all methods except @Hidden
156
+ controller.methods
157
+ .filter(method => !method.isHidden)
158
+ .forEach(method => {
159
+ const normalisedMethodPath = (0, pathUtils_1.normalisePath)(method.path, '/');
160
+ let path = (0, pathUtils_1.normalisePath)(`${normalisedControllerPath}${normalisedMethodPath}`, '/', '', false);
161
+ path = (0, pathUtils_1.convertColonPathParams)(path);
162
+ paths[path] = paths[path] || {};
163
+ this.buildMethod(controller.name, method, paths[path], controller.produces);
164
+ });
165
+ });
166
+ return paths;
167
+ }
168
+ buildMethod(controllerName, method, pathObject, defaultProduces) {
169
+ const pathMethod = (pathObject[method.method] = this.buildOperation(controllerName, method, defaultProduces));
170
+ pathMethod.description = method.description;
171
+ pathMethod.summary = method.summary;
172
+ pathMethod.tags = method.tags;
173
+ // Use operationId tag otherwise fallback to generated. Warning: This doesn't check uniqueness.
174
+ pathMethod.operationId = method.operationId || pathMethod.operationId;
175
+ if (method.deprecated) {
176
+ pathMethod.deprecated = method.deprecated;
177
+ }
178
+ if (method.security) {
179
+ pathMethod.security = method.security;
180
+ }
181
+ const queriesParams = method.parameters.filter(p => p.in === 'queries');
182
+ pathMethod.parameters = method.parameters
183
+ .filter(p => {
184
+ return ['request', 'body-prop', 'res', 'queries', 'request-prop'].indexOf(p.in) === -1;
185
+ })
186
+ .map(p => this.buildParameter(p));
187
+ if (queriesParams.length > 1) {
188
+ throw new Error('Only one queries parameter allowed per controller method.');
189
+ }
190
+ if (queriesParams.length === 1) {
191
+ pathMethod.parameters.push(...this.buildQueriesParameter(queriesParams[0]));
192
+ }
193
+ const bodyPropParameter = this.buildBodyPropParameter(controllerName, method);
194
+ if (bodyPropParameter) {
195
+ pathMethod.parameters.push(bodyPropParameter);
196
+ }
197
+ if (pathMethod.parameters.filter((p) => p.in === 'body').length > 1) {
198
+ throw new Error('Only one body parameter allowed per controller method.');
199
+ }
200
+ method.extensions.forEach(ext => (pathMethod[ext.key] = ext.value));
201
+ }
202
+ buildOperation(controllerName, method, defaultProduces) {
203
+ const swaggerResponses = {};
204
+ let produces = [];
205
+ method.responses.forEach((res) => {
206
+ swaggerResponses[res.name] = {
207
+ description: res.description,
208
+ };
209
+ if (res.schema && !(0, isVoidType_1.isVoidType)(res.schema)) {
210
+ if (res.produces) {
211
+ produces.push(...res.produces);
212
+ }
213
+ swaggerResponses[res.name].schema = this.getSwaggerType(res.schema);
214
+ }
215
+ if (res.examples && res.examples[0]) {
216
+ if ((res.exampleLabels?.filter(e => e).length || 0) > 0) {
217
+ console.warn('Example labels are not supported in OpenAPI 2');
218
+ }
219
+ swaggerResponses[res.name].examples = { [swaggerUtils_1.DEFAULT_RESPONSE_MEDIA_TYPE]: res.examples[0] };
220
+ }
221
+ if (res.headers) {
222
+ const headers = {};
223
+ if (res.headers.dataType === 'refObject' || res.headers.dataType === 'nestedObjectLiteral') {
224
+ res.headers.properties.forEach((each) => {
225
+ headers[each.name] = {
226
+ ...this.getSwaggerType(each.type),
227
+ description: each.description,
228
+ };
229
+ });
230
+ }
231
+ else {
232
+ (0, runtime_1.assertNever)(res.headers);
233
+ }
234
+ swaggerResponses[res.name].headers = headers;
235
+ }
236
+ });
237
+ produces = Array.from(new Set(produces.filter(p => p !== undefined)));
238
+ if (produces.length === 0) {
239
+ produces = defaultProduces || [swaggerUtils_1.DEFAULT_RESPONSE_MEDIA_TYPE];
240
+ }
241
+ const operation = {
242
+ operationId: this.getOperationId(controllerName, method),
243
+ produces: produces,
244
+ responses: swaggerResponses,
245
+ };
246
+ const hasBody = method.parameters.some(p => p.in === 'body');
247
+ const hasFormData = method.parameters.some(p => p.in === 'formData');
248
+ if (hasBody || hasFormData) {
249
+ operation.consumes = [];
250
+ if (hasBody) {
251
+ operation.consumes.push(method.consumes || swaggerUtils_1.DEFAULT_REQUEST_MEDIA_TYPE);
252
+ }
253
+ if (hasFormData) {
254
+ operation.consumes.push('multipart/form-data');
255
+ }
256
+ }
257
+ return operation;
258
+ }
259
+ buildBodyPropParameter(controllerName, method) {
260
+ const properties = {};
261
+ const required = [];
262
+ method.parameters
263
+ .filter(p => p.in === 'body-prop')
264
+ .forEach(p => {
265
+ properties[p.name] = this.getSwaggerType(p.type);
266
+ properties[p.name].default = p.default;
267
+ properties[p.name].description = p.description;
268
+ properties[p.name].example = p.example === undefined ? undefined : p.example[0];
269
+ if (this.isRequiredWithoutDefault(p)) {
270
+ required.push(p.name);
271
+ }
272
+ });
273
+ if (!Object.keys(properties).length) {
274
+ return;
275
+ }
276
+ const parameter = {
277
+ in: 'body',
278
+ name: 'body',
279
+ schema: {
280
+ properties,
281
+ title: `${this.getOperationId(controllerName, method)}Body`,
282
+ type: 'object',
283
+ },
284
+ };
285
+ if (required.length) {
286
+ parameter.schema.required = required;
287
+ }
288
+ return parameter;
289
+ }
290
+ buildQueriesParameter(source) {
291
+ if (source.type.dataType === 'refObject' || source.type.dataType === 'nestedObjectLiteral') {
292
+ const properties = source.type.properties;
293
+ return properties.map(property => this.buildParameter(this.queriesPropertyToQueryParameter(property)));
294
+ }
295
+ throw new Error(`Queries '${source.name}' parameter must be an object.`);
296
+ }
297
+ buildParameter(source) {
298
+ let type = source.type;
299
+ if (source.in !== 'body' && source.type.dataType === 'refEnum') {
300
+ // swagger does not support referencing enums
301
+ // (except for body parameters), so we have to inline it
302
+ type = {
303
+ dataType: 'enum',
304
+ enums: source.type.enums,
305
+ };
306
+ }
307
+ const parameterType = this.getSwaggerType(type);
308
+ let parameter = {
309
+ default: source.default,
310
+ description: source.description,
311
+ in: source.in,
312
+ name: source.name,
313
+ required: this.isRequiredWithoutDefault(source),
314
+ ...(source.deprecated ? { 'x-deprecated': true } : {}),
315
+ ...(parameterType.$ref ? { schema: parameterType } : {}),
316
+ ...(parameterType.format ? { format: this.throwIfNotDataFormat(parameterType.format) } : {}),
317
+ };
318
+ if (runtime_1.Swagger.isQueryParameter(parameter) && parameterType.type === 'array') {
319
+ parameter.collectionFormat = 'multi';
320
+ }
321
+ if (parameter.schema) {
322
+ return parameter;
323
+ }
324
+ const validatorObjs = {};
325
+ Object.keys(source.validators)
326
+ .filter(validatorUtils_1.shouldIncludeValidatorInSchema)
327
+ .forEach(key => {
328
+ validatorObjs[key] = source.validators[key].value;
329
+ });
330
+ if (source.in === 'body' && source.type.dataType === 'array') {
331
+ parameter.schema = {
332
+ items: parameterType.items,
333
+ type: 'array',
334
+ };
335
+ }
336
+ else {
337
+ if (source.type.dataType === 'any') {
338
+ if (source.in === 'body') {
339
+ parameter.schema = { type: 'object' };
340
+ }
341
+ else {
342
+ parameter.type = 'string';
343
+ }
344
+ }
345
+ else {
346
+ if (parameterType.type) {
347
+ parameter.type = this.throwIfNotDataType(parameterType.type);
348
+ }
349
+ parameter.items = parameterType.items;
350
+ parameter.enum = parameterType.enum;
351
+ }
352
+ }
353
+ if (parameter.schema) {
354
+ parameter.schema = Object.assign({}, parameter.schema, validatorObjs);
355
+ }
356
+ else {
357
+ parameter = Object.assign({}, parameter, validatorObjs);
358
+ }
359
+ return parameter;
360
+ }
361
+ buildProperties(source) {
362
+ const properties = {};
363
+ source.forEach(property => {
364
+ let swaggerType = this.getSwaggerType(property.type);
365
+ const format = property.format;
366
+ swaggerType.description = property.description;
367
+ swaggerType.example = property.example;
368
+ swaggerType.format = format || swaggerType.format;
369
+ if (!swaggerType.$ref) {
370
+ swaggerType.default = property.default;
371
+ Object.keys(property.validators)
372
+ .filter(validatorUtils_1.shouldIncludeValidatorInSchema)
373
+ .forEach(key => {
374
+ swaggerType = { ...swaggerType, [key]: property.validators[key].value };
375
+ });
376
+ }
377
+ if (property.deprecated) {
378
+ swaggerType['x-deprecated'] = true;
379
+ }
380
+ if (property.title) {
381
+ swaggerType.title = property.title;
382
+ }
383
+ if (property.extensions) {
384
+ property.extensions.forEach(property => {
385
+ swaggerType[property.key] = property.value;
386
+ });
387
+ }
388
+ properties[property.name] = swaggerType;
389
+ });
390
+ return properties;
391
+ }
392
+ getSwaggerTypeForUnionType(type) {
393
+ const typesWithoutUndefined = type.types.filter(x => x.dataType !== 'undefined');
394
+ // Backwards compatible representation of a literal enumeration
395
+ if (typesWithoutUndefined.every(subType => subType.dataType === 'enum')) {
396
+ const mergedEnum = { dataType: 'enum', enums: [] };
397
+ typesWithoutUndefined.forEach(t => {
398
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
399
+ mergedEnum.enums = [...mergedEnum.enums, ...t.enums];
400
+ });
401
+ return this.getSwaggerTypeForEnumType(mergedEnum);
402
+ }
403
+ else if (typesWithoutUndefined.length === 2 && typesWithoutUndefined.find(typeInUnion => typeInUnion.dataType === 'enum' && typeInUnion.enums.includes(null))) {
404
+ // Backwards compatible representation of dataType or null, $ref does not allow any sibling attributes, so we have to bail out
405
+ const nullEnumIndex = typesWithoutUndefined.findIndex(type => type.dataType === 'enum' && type.enums.includes(null));
406
+ const typeIndex = nullEnumIndex === 1 ? 0 : 1;
407
+ const swaggerType = this.getSwaggerType(typesWithoutUndefined[typeIndex]);
408
+ const isRef = !!swaggerType.$ref;
409
+ if (isRef) {
410
+ return { type: 'object' };
411
+ }
412
+ else {
413
+ swaggerType['x-nullable'] = true;
414
+ return swaggerType;
415
+ }
416
+ }
417
+ else if (process.env.NODE_ENV !== 'tsoa_test') {
418
+ // eslint-disable-next-line no-console
419
+ console.warn('Swagger 2.0 does not support union types beyond string literals.\n' + 'If you would like to take advantage of this, please change tsoa.json\'s "specVersion" to 3.');
420
+ }
421
+ return { type: 'object' };
422
+ }
423
+ getSwaggerTypeForIntersectionType(type) {
424
+ const properties = type.types.reduce((acc, type) => {
425
+ if (type.dataType === 'refObject') {
426
+ let refType = type;
427
+ refType = this.metadata.referenceTypeMap[refType.refName];
428
+ const props = refType &&
429
+ refType.properties &&
430
+ refType.properties.reduce((acc, prop) => {
431
+ return {
432
+ ...acc,
433
+ [prop.name]: this.getSwaggerType(prop.type),
434
+ };
435
+ }, {});
436
+ return { ...acc, ...props };
437
+ }
438
+ else {
439
+ process.env.NODE_ENV !== 'tsoa_test' &&
440
+ // eslint-disable-next-line no-console
441
+ console.warn('Swagger 2.0 does not fully support this kind of intersection types. If you would like to take advantage of this, please change tsoa.json\'s "specVersion" to 3.');
442
+ return { ...acc };
443
+ }
444
+ }, {});
445
+ return { type: 'object', properties };
446
+ }
447
+ getSwaggerTypeForReferenceType(referenceType) {
448
+ return { $ref: `#/definitions/${encodeURIComponent(referenceType.refName)}` };
449
+ }
450
+ decideEnumType(anEnum, nameOfEnum) {
451
+ const typesUsedInEnum = this.determineTypesUsedInEnum(anEnum);
452
+ const badEnumErrorMessage = () => {
453
+ const valuesDelimited = Array.from(typesUsedInEnum).join(',');
454
+ return `Enums can only have string or number values, but enum ${nameOfEnum} had ${valuesDelimited}`;
455
+ };
456
+ let enumTypeForSwagger;
457
+ if (typesUsedInEnum.has('string') && typesUsedInEnum.size === 1) {
458
+ enumTypeForSwagger = 'string';
459
+ }
460
+ else if (typesUsedInEnum.has('number') && typesUsedInEnum.size === 1) {
461
+ enumTypeForSwagger = 'number';
462
+ }
463
+ else {
464
+ throw new Error(badEnumErrorMessage());
465
+ }
466
+ return enumTypeForSwagger;
467
+ }
468
+ getSwaggerTypeForEnumType(enumType) {
469
+ const types = this.determineTypesUsedInEnum(enumType.enums);
470
+ const type = types.size === 1 ? types.values().next().value : 'string';
471
+ const nullable = enumType.enums.includes(null) ? true : false;
472
+ return { type, enum: enumType.enums.map(member => (0, swaggerUtils_1.getValue)(type, member)), ['x-nullable']: nullable };
473
+ }
474
+ }
475
+ exports.SpecGenerator2 = SpecGenerator2;
476
+ //# sourceMappingURL=specGenerator2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specGenerator2.js","sourceRoot":"","sources":["../../src/swagger/specGenerator2.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,gDAA+D;AAE/D,mDAA+C;AAE/C,oDAAgD;AAChD,kDAA0E;AAC1E,kDAAmD;AACnD,wDAAyG;AAEzG,4DAAwE;AAExE,MAAa,cAAe,SAAQ,6BAAa;IAE1B;IACA;IAFrB,YACqB,QAAuB,EACvB,MAA0B;QAE7C,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAHJ,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAoB;IAG/C,CAAC;IAEM,OAAO;QACZ,IAAI,IAAI,GAAkB;YACxB,QAAQ,EAAE,IAAA,yBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,QAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC;YAC9E,QAAQ,EAAE,CAAC,yCAA0B,CAAC;YACtC,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE;YACpC,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE;aACV;YACD,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;YACxB,QAAQ,EAAE,CAAC,0CAA2B,CAAC;YACvC,OAAO,EAAE,KAAK;SACf,CAAA;QAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAA;QAClG,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACtD,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;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AAC,CAAC,CAAC,CAAE,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAgC,CAAC,CAAC,CAAC,QAAQ,CAAA;QAClG,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;QAC7D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,uBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAA;IACvG,CAAC;CACF;AAlgBD,wCAkgBC"}
@@ -0,0 +1,158 @@
1
+ import { Swagger, Tsoa } from '@tsoa-next/runtime';
2
+ import { ExtendedSpecConfig } from '../cli';
3
+ import { SpecGenerator } from './specGenerator';
4
+ /**
5
+ * TODO:
6
+ * Handle formData parameters
7
+ * Handle requestBodies of type other than json
8
+ * Handle requestBodies as reusable objects
9
+ * Handle headers, examples, responses, etc.
10
+ * Cleaner interface between SpecGenerator2 and SpecGenerator3
11
+ * Also accept OpenAPI 3.0.0 metadata, like components/securitySchemes instead of securityDefinitions
12
+ */
13
+ export declare class SpecGenerator3 extends SpecGenerator {
14
+ protected readonly metadata: Tsoa.Metadata;
15
+ protected readonly config: ExtendedSpecConfig;
16
+ constructor(metadata: Tsoa.Metadata, config: ExtendedSpecConfig);
17
+ GetSpec(): Swagger.Spec3;
18
+ protected buildInfo(): Swagger.Info;
19
+ protected buildComponents(): {
20
+ examples: {};
21
+ headers: {};
22
+ parameters: {};
23
+ requestBodies: {};
24
+ responses: {};
25
+ schemas: {
26
+ [name: string]: Swagger.Schema3;
27
+ };
28
+ securitySchemes: {};
29
+ };
30
+ protected translateSecurityDefinitions(definitions: {
31
+ [name: string]: Swagger.SecuritySchemes;
32
+ }): {
33
+ [name: string]: Swagger.SecuritySchemes;
34
+ };
35
+ protected hasOAuthFlow(definition: any): definition is {
36
+ flow: string;
37
+ };
38
+ protected hasOAuthFlows(definition: any): definition is {
39
+ flows: Swagger.OAuthFlow;
40
+ };
41
+ protected buildServers(): Swagger.Server[];
42
+ protected buildSchema(): {
43
+ [name: string]: Swagger.Schema3;
44
+ };
45
+ protected buildPaths(): {
46
+ [pathName: string]: Swagger.Path3;
47
+ };
48
+ protected buildMethod(controllerName: string, method: Tsoa.Method, pathObject: any, defaultProduces?: string[]): void;
49
+ protected buildOperation(controllerName: string, method: Tsoa.Method, defaultProduces?: string[]): Swagger.Operation3;
50
+ protected buildRequestBodyWithFormData(controllerName: string, method: Tsoa.Method, parameters: Tsoa.Parameter[]): Swagger.RequestBody;
51
+ protected buildRequestBody(controllerName: string, method: Tsoa.Method, parameter: Tsoa.Parameter): Swagger.RequestBody;
52
+ protected buildMediaType(controllerName: string, method: Tsoa.Method, parameter: Tsoa.Parameter): Swagger.MediaType;
53
+ protected buildQueriesParameter(source: Tsoa.Parameter): Swagger.Parameter3[];
54
+ protected buildParameter(source: Tsoa.Parameter): Swagger.Parameter3;
55
+ protected buildExamples(source: Pick<Tsoa.Parameter, 'example' | 'exampleLabels'>): {
56
+ example?: unknown;
57
+ examples?: {
58
+ [name: string]: Swagger.Example3;
59
+ };
60
+ };
61
+ protected buildProperties(source: Tsoa.Property[]): {
62
+ [propertyName: string]: Swagger.Schema3;
63
+ };
64
+ protected getSwaggerTypeForReferenceType(referenceType: Tsoa.ReferenceType): Swagger.BaseSchema;
65
+ protected getSwaggerTypeForPrimitiveType(dataType: Tsoa.PrimitiveTypeLiteral): Swagger.BaseSchema;
66
+ protected isNull(type: Tsoa.Type): boolean;
67
+ protected groupEnums(types: Swagger.BaseSchema[]): Swagger.BaseSchema<unknown>[];
68
+ protected removeDuplicateSwaggerTypes(types: Swagger.BaseSchema[]): Swagger.BaseSchema[];
69
+ protected getSwaggerTypeForUnionType(type: Tsoa.UnionType, title?: string): {
70
+ allOf: Swagger.BaseSchema<unknown>[];
71
+ nullable: true;
72
+ } | {
73
+ nullable: true;
74
+ type?: string;
75
+ format?: Swagger.DataFormat;
76
+ $ref?: string;
77
+ title?: string;
78
+ description?: string;
79
+ default?: string | boolean | number | unknown;
80
+ multipleOf?: number;
81
+ maximum?: number;
82
+ exclusiveMaximum?: number;
83
+ minimum?: number;
84
+ exclusiveMinimum?: number;
85
+ maxLength?: number;
86
+ minLength?: number;
87
+ pattern?: string;
88
+ maxItems?: number;
89
+ minItems?: number;
90
+ uniqueItems?: boolean;
91
+ maxProperties?: number;
92
+ minProperties?: number;
93
+ enum?: Array<boolean | string | number | null>;
94
+ 'x-enum-varnames'?: string[];
95
+ additionalProperties?: boolean | Swagger.BaseSchema;
96
+ properties?: {
97
+ [propertyName: string]: unknown;
98
+ } | undefined;
99
+ discriminator?: string;
100
+ readOnly?: boolean;
101
+ xml?: Swagger.XML;
102
+ externalDocs?: Swagger.ExternalDocs;
103
+ example?: unknown;
104
+ required?: string[];
105
+ items?: Swagger.BaseSchema;
106
+ allOf?: undefined;
107
+ } | {
108
+ anyOf: Swagger.BaseSchema<unknown>[];
109
+ nullable: true;
110
+ title?: string | undefined;
111
+ allOf?: undefined;
112
+ } | {
113
+ type?: string;
114
+ format?: Swagger.DataFormat;
115
+ $ref?: string;
116
+ title?: string;
117
+ description?: string;
118
+ default?: string | boolean | number | unknown;
119
+ multipleOf?: number;
120
+ maximum?: number;
121
+ exclusiveMaximum?: number;
122
+ minimum?: number;
123
+ exclusiveMinimum?: number;
124
+ maxLength?: number;
125
+ minLength?: number;
126
+ pattern?: string;
127
+ maxItems?: number;
128
+ minItems?: number;
129
+ uniqueItems?: boolean;
130
+ maxProperties?: number;
131
+ minProperties?: number;
132
+ enum?: Array<boolean | string | number | null>;
133
+ 'x-enum-varnames'?: string[];
134
+ additionalProperties?: boolean | Swagger.BaseSchema;
135
+ properties?: {
136
+ [propertyName: string]: unknown;
137
+ } | undefined;
138
+ discriminator?: string;
139
+ readOnly?: boolean;
140
+ xml?: Swagger.XML;
141
+ externalDocs?: Swagger.ExternalDocs;
142
+ example?: unknown;
143
+ required?: string[];
144
+ items?: Swagger.BaseSchema;
145
+ allOf?: undefined;
146
+ nullable?: undefined;
147
+ } | {
148
+ anyOf: Swagger.BaseSchema<unknown>[];
149
+ title?: string | undefined;
150
+ allOf?: undefined;
151
+ nullable?: undefined;
152
+ };
153
+ protected getSwaggerTypeForIntersectionType(type: Tsoa.IntersectionType, title?: string): {
154
+ title?: string | undefined;
155
+ allOf: Swagger.BaseSchema<unknown>[];
156
+ };
157
+ protected getSwaggerTypeForEnumType(enumType: Tsoa.EnumType, title?: string): Swagger.Schema3;
158
+ }