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