@routup/swagger-preset
Version:
Swagger preset for routup swagger generation.
294 lines (284 loc) • 6.67 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var swagger = require('@trapi/swagger');
function buildClassDecoratorConfig() {
return [
{
id: swagger.DecoratorID.CONTROLLER,
name: 'DController',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DController',
properties: {
value: {}
}
}
];
}
function buildMethodDecoratorConfig() {
return [
{
id: swagger.DecoratorID.ALL,
name: 'DAll',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DAll',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.DELETE,
name: 'DDelete',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DDelete',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.GET,
name: 'DGet',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DGet',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.HEAD,
name: 'DHead',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DHead',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.OPTIONS,
name: 'DOptions',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DOptions',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.PATCH,
name: 'DPatch',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DPatch',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.POST,
name: 'DPost',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DPost',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.PUT,
name: 'DPut',
properties: {}
},
{
id: swagger.DecoratorID.MOUNT,
name: 'DPut',
properties: {
value: {}
}
}
];
}
function buildParameterDecoratorConfig() {
return [
{
id: swagger.DecoratorID.CONTEXT,
name: 'DRequest',
properties: {}
},
{
id: swagger.DecoratorID.CONTEXT,
name: 'DResponse',
properties: {}
},
{
id: swagger.DecoratorID.CONTEXT,
name: 'DNext',
properties: {}
},
{
id: swagger.DecoratorID.QUERY,
name: 'DQuery',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.BODY,
name: 'DBody',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.HEADER,
name: 'DHeader',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.HEADERS,
name: 'DHeaders',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.COOKIE,
name: 'DCookie',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.COOKIES,
name: 'DCookies',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.PATH,
name: 'DPath',
properties: {
value: {}
}
},
{
id: swagger.DecoratorID.PATHS,
name: 'DPaths',
properties: {
value: {}
}
}
];
}
function buildSwaggerDecoratorConfig() {
return [
{
id: swagger.DecoratorID.CONSUMES,
name: 'DConsumes',
properties: {
value: {
amount: -1,
strategy: 'merge'
}
}
},
{
id: swagger.DecoratorID.DEPRECATED,
name: 'DDeprecated'
},
{
id: swagger.DecoratorID.DESCRIPTION,
name: 'DDescription',
properties: {
type: {
isType: true
},
payload: {
index: 2
},
statusCode: {
index: 0
},
description: {
index: 1
}
}
},
{
id: swagger.DecoratorID.EXAMPLE,
name: 'DExample',
properties: {
type: {
isType: true
},
payload: {}
}
},
{
id: swagger.DecoratorID.HIDDEN,
name: 'DHidden'
},
{
id: swagger.DecoratorID.SECURITY,
name: 'DSecurity',
properties: {
key: {
index: 1
},
value: {
index: 0
}
}
},
{
id: swagger.DecoratorID.TAGS,
name: 'DTags',
properties: {
value: {
amount: -1,
strategy: 'merge'
}
}
}
];
}
function buildDecoratorConfig() {
return [
...buildSwaggerDecoratorConfig(),
...buildMethodDecoratorConfig(),
...buildClassDecoratorConfig(),
...buildParameterDecoratorConfig()
];
}
var index = {
extends: [],
items: buildDecoratorConfig()
};
exports.buildDecoratorConfig = buildDecoratorConfig;
exports.default = index;
module.exports = Object.assign(exports.default, exports);
//# sourceMappingURL=index.cjs.map