@moostjs/swagger 0.5.21 → 0.5.23

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.mjs CHANGED
@@ -1,625 +1,517 @@
1
- import { getMoostMate, Controller, Const, useEventLogger, useControllerContext, Moost } from 'moost';
2
- import { Get, SetHeader, Url, HeaderHook, StatusHook } from '@moostjs/event-http';
3
- import { getZodType, z, getZodTypeForProp, ZodSkip } from '@moostjs/zod';
4
- import { useSetHeaders } from '@wooksjs/event-http';
5
- import { serveFile } from '@wooksjs/http-static';
6
- import Path from 'path';
7
- import { getAbsoluteFSPath } from 'swagger-ui-dist';
8
- import { parseZodType } from 'zod-parser';
1
+ import { Const, Controller, Moost, getMoostMate, useControllerContext, useEventLogger } from "moost";
2
+ import { Get, HeaderHook, SetHeader, StatusHook, Url } from "@moostjs/event-http";
3
+ import { ZodSkip, getZodType, getZodTypeForProp, z } from "@moostjs/zod";
4
+ import { THeaderHook, useSetHeaders } from "@wooksjs/event-http";
5
+ import { serveFile } from "@wooksjs/http-static";
6
+ import Path from "path";
7
+ import { getAbsoluteFSPath } from "swagger-ui-dist";
8
+ import { parseZodType } from "zod-parser";
9
9
 
10
+ //#region packages/swagger/src/swagger.mate.ts
10
11
  function getSwaggerMate() {
11
- return getMoostMate();
12
+ return getMoostMate();
12
13
  }
13
14
 
14
- const SwaggerTag = (tag) => getSwaggerMate().decorate('swaggerTags', tag, true);
15
- const SwaggerExclude = () => getSwaggerMate().decorate('swaggerExclude', true);
16
- const SwaggerDescription = (descr) => getSwaggerMate().decorate('swaggerDescription', descr);
15
+ //#endregion
16
+ //#region packages/swagger/src/decorators.ts
17
+ const SwaggerTag = (tag) => getSwaggerMate().decorate("swaggerTags", tag, true);
18
+ const SwaggerExclude = () => getSwaggerMate().decorate("swaggerExclude", true);
19
+ const SwaggerDescription = (descr) => getSwaggerMate().decorate("swaggerDescription", descr);
17
20
  function SwaggerResponse(code, opts, example) {
18
- return getSwaggerMate().decorate(meta => {
19
- let ex;
20
- if (example) {
21
- ex = example;
22
- }
23
- if (typeof code !== 'number' && opts) {
24
- ex = opts;
25
- }
26
- meta.swaggerResponses = meta.swaggerResponses || {};
27
- const keyCode = typeof code === 'number' ? code : 0;
28
- const opt = typeof code === 'number' ? opts : code;
29
- const contentType = typeof opt.contentType === 'string'
30
- ? opt.contentType
31
- : '*/*';
32
- const response = (['object', 'function'].includes(typeof opt.response)
33
- ? opt.response
34
- : opt);
35
- meta.swaggerResponses[keyCode] = meta.swaggerResponses[keyCode] || {};
36
- meta.swaggerResponses[keyCode][contentType] = { response, example: ex };
37
- return meta;
38
- });
21
+ return getSwaggerMate().decorate((meta) => {
22
+ let ex;
23
+ if (example) ex = example;
24
+ if (typeof code !== "number" && opts) ex = opts;
25
+ meta.swaggerResponses = meta.swaggerResponses || {};
26
+ const keyCode = typeof code === "number" ? code : 0;
27
+ const opt = typeof code === "number" ? opts : code;
28
+ const contentType = typeof opt.contentType === "string" ? opt.contentType : "*/*";
29
+ const response = ["object", "function"].includes(typeof opt.response) ? opt.response : opt;
30
+ meta.swaggerResponses[keyCode] = meta.swaggerResponses[keyCode] || {};
31
+ meta.swaggerResponses[keyCode][contentType] = {
32
+ response,
33
+ example: ex
34
+ };
35
+ return meta;
36
+ });
39
37
  }
40
38
  function SwaggerRequestBody(opt) {
41
- return getSwaggerMate().decorate(meta => {
42
- meta.swaggerRequestBody = meta.swaggerRequestBody || {};
43
- const contentType = typeof opt.contentType === 'string'
44
- ? opt.contentType
45
- : 'application/json';
46
- const response = (typeof opt.contentType === 'string'
47
- ? opt.response
48
- : opt);
49
- meta.swaggerRequestBody[contentType] = response;
50
- return meta;
51
- });
39
+ return getSwaggerMate().decorate((meta) => {
40
+ meta.swaggerRequestBody = meta.swaggerRequestBody || {};
41
+ const contentType = typeof opt.contentType === "string" ? opt.contentType : "application/json";
42
+ const response = typeof opt.contentType === "string" ? opt.response : opt;
43
+ meta.swaggerRequestBody[contentType] = response;
44
+ return meta;
45
+ });
52
46
  }
53
47
  function SwaggerParam(opts) {
54
- return getSwaggerMate().decorate('swaggerParams', opts, true);
48
+ return getSwaggerMate().decorate("swaggerParams", opts, true);
55
49
  }
56
50
  function SwaggerExample(example) {
57
- return getSwaggerMate().decorate('swaggerExample', example);
51
+ return getSwaggerMate().decorate("swaggerExample", example);
58
52
  }
59
53
 
60
- /******************************************************************************
61
- Copyright (c) Microsoft Corporation.
62
-
63
- Permission to use, copy, modify, and/or distribute this software for any
64
- purpose with or without fee is hereby granted.
65
-
66
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
67
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
68
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
69
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
70
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
71
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
72
- PERFORMANCE OF THIS SOFTWARE.
73
- ***************************************************************************** */
74
- /* global Reflect, Promise, SuppressedError, Symbol */
75
-
76
-
77
- function __decorate(decorators, target, key, desc) {
78
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
79
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
80
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
81
- return c > 3 && r && Object.defineProperty(target, key, r), r;
82
- }
83
-
84
- function __param(paramIndex, decorator) {
85
- return function (target, key) { decorator(target, key, paramIndex); }
86
- }
87
-
88
- function __metadata(metadataKey, metadataValue) {
89
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
90
- }
91
-
92
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
93
- var e = new Error(message);
94
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
95
- };
96
-
54
+ //#endregion
55
+ //#region packages/swagger/src/mapping.ts
97
56
  function mapToSwaggerSpec(metadata, options, logger) {
98
- const swaggerSpec = {
99
- openapi: '3.0.0',
100
- info: {
101
- title: options?.title || 'API Documentation',
102
- version: options?.version || '1.0.0',
103
- },
104
- paths: {},
105
- tags: [],
106
- components: {
107
- schemas: globalSchemas,
108
- },
109
- };
110
- for (const controller of metadata) {
111
- const cmeta = controller.meta;
112
- if (cmeta?.swaggerExclude) {
113
- continue;
114
- }
115
- const controllerTags = cmeta?.swaggerTags || [];
116
- for (const handler of controller.handlers) {
117
- const hmeta = handler.meta;
118
- const hh = handler.handler;
119
- if (hh.type !== 'HTTP' || hmeta?.swaggerExclude || handler.registeredAs.length === 0) {
120
- continue;
121
- }
122
- const uniqueParams = {};
123
- const handlerPath = handler.registeredAs[0].path;
124
- const handlerMethod = hh.method?.toLowerCase() || 'get';
125
- const handlerDescription = hmeta?.description;
126
- const handlerTags = [...controllerTags, ...(hmeta?.swaggerTags || [])];
127
- if (!swaggerSpec.paths[handlerPath]) {
128
- swaggerSpec.paths[handlerPath] = {};
129
- }
130
- let responses;
131
- if (hmeta?.swaggerResponses) {
132
- for (const [code, responseConfigs] of Object.entries(hmeta.swaggerResponses)) {
133
- const newCode = code === '0' ? getDefaultStatusCode(handlerMethod) : code;
134
- for (const [contentType, conf] of Object.entries(responseConfigs)) {
135
- const { response, example } = conf;
136
- const schema = getSwaggerSchemaFromSwaggerConfigType(response);
137
- if (schema) {
138
- responses = responses || {};
139
- responses[newCode] = {
140
- content: {
141
- [contentType]: { schema: { ...schema, example: example || schema.example } },
142
- },
143
- };
144
- }
145
- }
146
- }
147
- }
148
- else if (hmeta?.returnType) {
149
- const parsed = myParseZod(getZodType({
150
- type: hmeta.returnType,
151
- }));
152
- if (['ZodString', 'ZodNumber', 'ZodObject', 'ZodArray', 'ZodBoolean'].includes(parsed.$type)) {
153
- const schema = getSwaggerSchema(parsed);
154
- if (schema) {
155
- responses = responses || {};
156
- responses[getDefaultStatusCode(handlerMethod)] = {
157
- content: {
158
- '*/*': {
159
- schema,
160
- },
161
- },
162
- };
163
- }
164
- }
165
- }
166
- let reqBodyRequired = true;
167
- const bodyConfig = {};
168
- if (hmeta?.swaggerRequestBody) {
169
- for (const [contentType, type] of Object.entries(hmeta.swaggerRequestBody)) {
170
- let zt;
171
- let schema;
172
- if (type instanceof z.ZodType) {
173
- zt = type;
174
- }
175
- else if (typeof type === 'function') {
176
- zt = getZodType({
177
- type,
178
- });
179
- }
180
- if (zt) {
181
- const parsed = myParseZod(zt);
182
- if (['ZodString', 'ZodNumber', 'ZodObject', 'ZodArray', 'ZodBoolean'].includes(parsed.$type)) {
183
- schema = getSwaggerSchema(parsed);
184
- }
185
- }
186
- bodyConfig[contentType] = { schema };
187
- }
188
- }
189
- swaggerSpec.paths[handlerPath][handlerMethod] = {
190
- summary: handlerDescription,
191
- operationId: `${handlerMethod.toUpperCase()}_${handlerPath
192
- .replace(/\//g, '_')
193
- .replace(/[{}]/g, '__')
194
- .replace(/[^\dA-Za-z]/g, '_')}`,
195
- tags: handlerTags,
196
- parameters: [],
197
- responses,
198
- };
199
- const endpointSpec = swaggerSpec.paths[handlerPath][handlerMethod];
200
- function addParam(param) {
201
- const key = `${param.in}//${param.name}`;
202
- if (uniqueParams[key]) {
203
- uniqueParams[key].description = param.description ?? uniqueParams[key].description;
204
- uniqueParams[key].required = param.required;
205
- uniqueParams[key].schema = param.schema ?? uniqueParams[key].schema;
206
- }
207
- else {
208
- uniqueParams[key] = param;
209
- endpointSpec.parameters.push(param);
210
- }
211
- }
212
- for (const param of cmeta?.swaggerParams || []) {
213
- addParam({
214
- name: param.name,
215
- in: param.in,
216
- description: param.description,
217
- required: !!param.required,
218
- schema: getSwaggerSchemaFromSwaggerConfigType(param.type) || { type: 'string' },
219
- });
220
- }
221
- for (const param of hmeta?.swaggerParams || []) {
222
- addParam({
223
- name: param.name,
224
- in: param.in,
225
- description: param.description,
226
- required: !!param.required,
227
- schema: getSwaggerSchemaFromSwaggerConfigType(param.type) || { type: 'string' },
228
- });
229
- }
230
- for (const paramName of handler.registeredAs[0].args) {
231
- const paramIndex = handler.meta.params.findIndex(param => param.paramSource === 'ROUTE' && param.paramName === paramName);
232
- const paramMeta = handler.meta.params[paramIndex];
233
- let schema;
234
- let parsed;
235
- if (paramMeta) {
236
- const zodType = getZodTypeForProp({
237
- type: controller.type,
238
- key: handler.method,
239
- index: paramIndex,
240
- }, {
241
- type: paramMeta.type,
242
- additionalMeta: paramMeta,
243
- }, undefined, logger);
244
- parsed = myParseZod(zodType);
245
- schema = getSwaggerSchema(parsed, true);
246
- }
247
- addParam({
248
- name: paramName,
249
- in: 'path',
250
- description: paramMeta ? paramMeta.description : undefined,
251
- required: !paramMeta.optional && !parsed?.$optional,
252
- schema: schema || { type: 'string' },
253
- });
254
- }
255
- for (let i = 0; i < handler.meta.params.length; i++) {
256
- const paramMeta = handler.meta.params[i];
257
- if (paramMeta.paramSource && ['QUERY_ITEM', 'QUERY'].includes(paramMeta.paramSource)) {
258
- const zodType = getZodTypeForProp({
259
- type: controller.type,
260
- key: handler.method,
261
- index: i,
262
- }, {
263
- type: paramMeta.type,
264
- additionalMeta: paramMeta,
265
- }, undefined, logger);
266
- const parsed = myParseZod(zodType);
267
- const schema = getSwaggerSchema(parsed, true);
268
- if (paramMeta.paramSource === 'QUERY_ITEM') {
269
- endpointSpec.parameters.push({
270
- name: paramMeta.paramName || '',
271
- in: 'query',
272
- description: paramMeta.description,
273
- required: !paramMeta.optional && !parsed.$optional,
274
- schema: schema || { type: 'string' },
275
- });
276
- }
277
- else if (paramMeta.paramSource === 'QUERY' && parsed.$type === 'ZodObject') {
278
- for (const [key, value] of Object.entries(parsed.$inner)) {
279
- const schema = getSwaggerSchema(value, true);
280
- if (schema) {
281
- const swaggerSchema = {
282
- name: key,
283
- in: 'query',
284
- description: value.description,
285
- required: !parsed.$optional && !value.$optional,
286
- schema,
287
- };
288
- endpointSpec.parameters.push(swaggerSchema);
289
- }
290
- }
291
- }
292
- }
293
- if (paramMeta.paramSource === 'BODY') {
294
- const zodType = getZodTypeForProp({
295
- type: controller.type,
296
- key: handler.method,
297
- index: i,
298
- }, {
299
- type: paramMeta.type,
300
- additionalMeta: paramMeta,
301
- }, undefined, logger);
302
- const parsed = myParseZod(zodType);
303
- let contentType = '';
304
- switch (parsed.$type) {
305
- case 'ZodString':
306
- case 'ZodNumber':
307
- case 'ZodBigInt':
308
- case 'ZodBoolean':
309
- case 'ZodDate':
310
- case 'ZodEnum':
311
- case 'ZodNativeEnum':
312
- case 'ZodLiteral': {
313
- contentType = 'text/plan';
314
- break;
315
- }
316
- default: {
317
- contentType = 'application/json';
318
- }
319
- }
320
- if (!bodyConfig[contentType]) {
321
- bodyConfig[contentType] = { schema: getSwaggerSchema(parsed) };
322
- }
323
- reqBodyRequired = !zodType.isOptional() && !paramMeta.optional;
324
- }
325
- }
326
- if (Object.entries(bodyConfig).some(e => !!e[1])) {
327
- swaggerSpec.paths[handlerPath][handlerMethod].requestBody = {
328
- content: bodyConfig,
329
- required: reqBodyRequired,
330
- };
331
- }
332
- }
333
- }
334
- return swaggerSpec;
57
+ const swaggerSpec = {
58
+ openapi: "3.0.0",
59
+ info: {
60
+ title: options?.title || "API Documentation",
61
+ version: options?.version || "1.0.0"
62
+ },
63
+ paths: {},
64
+ tags: [],
65
+ components: { schemas: globalSchemas }
66
+ };
67
+ for (const controller of metadata) {
68
+ const cmeta = controller.meta;
69
+ if (cmeta?.swaggerExclude) continue;
70
+ const controllerTags = cmeta?.swaggerTags || [];
71
+ for (const handler of controller.handlers) {
72
+ const hmeta = handler.meta;
73
+ const hh = handler.handler;
74
+ if (hh.type !== "HTTP" || hmeta?.swaggerExclude || handler.registeredAs.length === 0) continue;
75
+ const uniqueParams = {};
76
+ const handlerPath = handler.registeredAs[0].path;
77
+ const handlerMethod = hh.method?.toLowerCase() || "get";
78
+ const handlerDescription = hmeta?.description;
79
+ const handlerTags = [...controllerTags, ...hmeta?.swaggerTags || []];
80
+ if (!swaggerSpec.paths[handlerPath]) swaggerSpec.paths[handlerPath] = {};
81
+ let responses;
82
+ if (hmeta?.swaggerResponses) for (const [code, responseConfigs] of Object.entries(hmeta.swaggerResponses)) {
83
+ const newCode = code === "0" ? getDefaultStatusCode(handlerMethod) : code;
84
+ for (const [contentType, conf] of Object.entries(responseConfigs)) {
85
+ const { response, example } = conf;
86
+ const schema = getSwaggerSchemaFromSwaggerConfigType(response);
87
+ if (schema) {
88
+ responses = responses || {};
89
+ responses[newCode] = { content: { [contentType]: { schema: {
90
+ ...schema,
91
+ example: example || schema.example
92
+ } } } };
93
+ }
94
+ }
95
+ }
96
+ else if (hmeta?.returnType) {
97
+ const parsed = myParseZod(getZodType({ type: hmeta.returnType }));
98
+ if ([
99
+ "ZodString",
100
+ "ZodNumber",
101
+ "ZodObject",
102
+ "ZodArray",
103
+ "ZodBoolean"
104
+ ].includes(parsed.$type)) {
105
+ const schema = getSwaggerSchema(parsed);
106
+ if (schema) {
107
+ responses = responses || {};
108
+ responses[getDefaultStatusCode(handlerMethod)] = { content: { "*/*": { schema } } };
109
+ }
110
+ }
111
+ }
112
+ let reqBodyRequired = true;
113
+ const bodyConfig = {};
114
+ if (hmeta?.swaggerRequestBody) for (const [contentType, type] of Object.entries(hmeta.swaggerRequestBody)) {
115
+ let zt;
116
+ let schema;
117
+ if (type instanceof z.ZodType) zt = type;
118
+ else if (typeof type === "function") zt = getZodType({ type });
119
+ if (zt) {
120
+ const parsed = myParseZod(zt);
121
+ if ([
122
+ "ZodString",
123
+ "ZodNumber",
124
+ "ZodObject",
125
+ "ZodArray",
126
+ "ZodBoolean"
127
+ ].includes(parsed.$type)) schema = getSwaggerSchema(parsed);
128
+ }
129
+ bodyConfig[contentType] = { schema };
130
+ }
131
+ swaggerSpec.paths[handlerPath][handlerMethod] = {
132
+ summary: handlerDescription,
133
+ operationId: `${handlerMethod.toUpperCase()}_${handlerPath.replace(/\//g, "_").replace(/[{}]/g, "__").replace(/[^\dA-Za-z]/g, "_")}`,
134
+ tags: handlerTags,
135
+ parameters: [],
136
+ responses
137
+ };
138
+ const endpointSpec = swaggerSpec.paths[handlerPath][handlerMethod];
139
+ function addParam(param) {
140
+ const key = `${param.in}//${param.name}`;
141
+ if (uniqueParams[key]) {
142
+ uniqueParams[key].description = param.description ?? uniqueParams[key].description;
143
+ uniqueParams[key].required = param.required;
144
+ uniqueParams[key].schema = param.schema ?? uniqueParams[key].schema;
145
+ } else {
146
+ uniqueParams[key] = param;
147
+ endpointSpec.parameters.push(param);
148
+ }
149
+ }
150
+ for (const param of cmeta?.swaggerParams || []) addParam({
151
+ name: param.name,
152
+ in: param.in,
153
+ description: param.description,
154
+ required: !!param.required,
155
+ schema: getSwaggerSchemaFromSwaggerConfigType(param.type) || { type: "string" }
156
+ });
157
+ for (const param of hmeta?.swaggerParams || []) addParam({
158
+ name: param.name,
159
+ in: param.in,
160
+ description: param.description,
161
+ required: !!param.required,
162
+ schema: getSwaggerSchemaFromSwaggerConfigType(param.type) || { type: "string" }
163
+ });
164
+ for (const paramName of handler.registeredAs[0].args) {
165
+ const paramIndex = handler.meta.params.findIndex((param) => param.paramSource === "ROUTE" && param.paramName === paramName);
166
+ const paramMeta = handler.meta.params[paramIndex];
167
+ let schema;
168
+ let parsed;
169
+ if (paramMeta) {
170
+ const zodType = getZodTypeForProp({
171
+ type: controller.type,
172
+ key: handler.method,
173
+ index: paramIndex
174
+ }, {
175
+ type: paramMeta.type,
176
+ additionalMeta: paramMeta
177
+ }, undefined, logger);
178
+ parsed = myParseZod(zodType);
179
+ schema = getSwaggerSchema(parsed, true);
180
+ }
181
+ addParam({
182
+ name: paramName,
183
+ in: "path",
184
+ description: paramMeta ? paramMeta.description : undefined,
185
+ required: !paramMeta.optional && !parsed?.$optional,
186
+ schema: schema || { type: "string" }
187
+ });
188
+ }
189
+ for (let i = 0; i < handler.meta.params.length; i++) {
190
+ const paramMeta = handler.meta.params[i];
191
+ if (paramMeta.paramSource && ["QUERY_ITEM", "QUERY"].includes(paramMeta.paramSource)) {
192
+ const zodType = getZodTypeForProp({
193
+ type: controller.type,
194
+ key: handler.method,
195
+ index: i
196
+ }, {
197
+ type: paramMeta.type,
198
+ additionalMeta: paramMeta
199
+ }, undefined, logger);
200
+ const parsed = myParseZod(zodType);
201
+ const schema = getSwaggerSchema(parsed, true);
202
+ if (paramMeta.paramSource === "QUERY_ITEM") endpointSpec.parameters.push({
203
+ name: paramMeta.paramName || "",
204
+ in: "query",
205
+ description: paramMeta.description,
206
+ required: !paramMeta.optional && !parsed.$optional,
207
+ schema: schema || { type: "string" }
208
+ });
209
+ else if (paramMeta.paramSource === "QUERY" && parsed.$type === "ZodObject") for (const [key, value] of Object.entries(parsed.$inner)) {
210
+ const schema$1 = getSwaggerSchema(value, true);
211
+ if (schema$1) {
212
+ const swaggerSchema = {
213
+ name: key,
214
+ in: "query",
215
+ description: value.description,
216
+ required: !parsed.$optional && !value.$optional,
217
+ schema: schema$1
218
+ };
219
+ endpointSpec.parameters.push(swaggerSchema);
220
+ }
221
+ }
222
+ }
223
+ if (paramMeta.paramSource === "BODY") {
224
+ const zodType = getZodTypeForProp({
225
+ type: controller.type,
226
+ key: handler.method,
227
+ index: i
228
+ }, {
229
+ type: paramMeta.type,
230
+ additionalMeta: paramMeta
231
+ }, undefined, logger);
232
+ const parsed = myParseZod(zodType);
233
+ let contentType = "";
234
+ switch (parsed.$type) {
235
+ case "ZodString":
236
+ case "ZodNumber":
237
+ case "ZodBigInt":
238
+ case "ZodBoolean":
239
+ case "ZodDate":
240
+ case "ZodEnum":
241
+ case "ZodNativeEnum":
242
+ case "ZodLiteral": {
243
+ contentType = "text/plan";
244
+ break;
245
+ }
246
+ default: contentType = "application/json";
247
+ }
248
+ if (!bodyConfig[contentType]) bodyConfig[contentType] = { schema: getSwaggerSchema(parsed) };
249
+ reqBodyRequired = !zodType.isOptional() && !paramMeta.optional;
250
+ }
251
+ }
252
+ if (bodyConfig && Object.entries(bodyConfig).some((e) => !!e[1])) swaggerSpec.paths[handlerPath][handlerMethod].requestBody = {
253
+ content: bodyConfig,
254
+ required: reqBodyRequired
255
+ };
256
+ }
257
+ }
258
+ return swaggerSpec;
335
259
  }
336
260
  const globalSchemas = {};
337
261
  function getSwaggerSchema(parsed, forParam) {
338
- const zodType = parsed.$ref;
339
- const meta = zodType.__type_ref ? getSwaggerMate().read(zodType.__type_ref) : undefined;
340
- if (!forParam && zodType.__type_ref && globalSchemas[zodType.__type_ref.name]) {
341
- return { $ref: `#/components/schemas/${zodType.__type_ref.name}` };
342
- }
343
- if (forParam && zodType.__type_ref && globalSchemas[zodType.__type_ref.name]) {
344
- return globalSchemas[zodType.__type_ref.name];
345
- }
346
- const schema = {};
347
- if (meta) {
348
- if (meta.swaggerExample) {
349
- schema.example = meta.swaggerExample;
350
- }
351
- if (meta.label || meta.id) {
352
- schema.title = meta.label || meta.id;
353
- }
354
- if (meta.description) {
355
- schema.description = meta.description;
356
- }
357
- }
358
- if (!forParam && zodType.__type_ref) {
359
- globalSchemas[zodType.__type_ref.name] = schema;
360
- }
361
- function asString() {
362
- schema.type = 'string';
363
- if (parsed.$checks) {
364
- const { regex } = parsed.$checks;
365
- if (regex) {
366
- schema.pattern = regex.source;
367
- }
368
- }
369
- }
370
- function asLiteral() {
371
- if (parsed.$type === 'ZodLiteral') {
372
- schema.type = 'string';
373
- schema.enum = [parsed.$value];
374
- }
375
- }
376
- function asEnum() {
377
- if (parsed.$type === 'ZodEnum') {
378
- schema.type = 'string';
379
- schema.enum = parsed.$value;
380
- }
381
- }
382
- function asNativeEnum() {
383
- if (parsed.$type === 'ZodNativeEnum') {
384
- schema.type = 'string';
385
- schema.enum = Object.keys(parsed.$value);
386
- }
387
- }
388
- if (forParam) {
389
- switch (parsed.$type) {
390
- case 'ZodAny':
391
- case 'ZodUnknown':
392
- case 'ZodString': {
393
- asString();
394
- break;
395
- }
396
- case 'ZodNumber': {
397
- schema.type = 'number';
398
- break;
399
- }
400
- case 'ZodBigInt': {
401
- schema.type = 'integer';
402
- break;
403
- }
404
- case 'ZodBoolean': {
405
- schema.type = 'boolean';
406
- break;
407
- }
408
- case 'ZodLiteral': {
409
- asLiteral();
410
- break;
411
- }
412
- case 'ZodEnum': {
413
- asEnum();
414
- break;
415
- }
416
- case 'ZodNativeEnum': {
417
- asNativeEnum();
418
- break;
419
- }
420
- case 'ZodDate': {
421
- schema.type = 'string';
422
- break;
423
- }
424
- case 'ZodNull': {
425
- schema.type = 'null';
426
- break;
427
- }
428
- default: {
429
- return undefined;
430
- }
431
- }
432
- }
433
- else {
434
- switch (parsed.$type) {
435
- case 'ZodString': {
436
- asString();
437
- break;
438
- }
439
- case 'ZodNumber': {
440
- schema.type = 'number';
441
- break;
442
- }
443
- case 'ZodBigInt': {
444
- schema.type = 'integer';
445
- break;
446
- }
447
- case 'ZodBoolean': {
448
- schema.type = 'boolean';
449
- break;
450
- }
451
- case 'ZodLiteral': {
452
- asLiteral();
453
- break;
454
- }
455
- case 'ZodEnum': {
456
- asEnum();
457
- break;
458
- }
459
- case 'ZodNativeEnum': {
460
- asNativeEnum();
461
- break;
462
- }
463
- case 'ZodDate': {
464
- schema.type = 'string';
465
- break;
466
- }
467
- case 'ZodNull': {
468
- schema.type = 'null';
469
- break;
470
- }
471
- case 'ZodFunction':
472
- case 'ZodSymbol':
473
- case 'ZodUndefined':
474
- case 'ZodUnknown':
475
- case 'ZodNever':
476
- case 'ZodVoid':
477
- case 'ZodNaN': {
478
- return undefined;
479
- }
480
- case 'ZodArray': {
481
- schema.type = 'array';
482
- schema.minItems = parsed.$checks?.minLength || undefined;
483
- schema.maxItems = parsed.$checks?.maxLength || undefined;
484
- schema.items = getSwaggerSchema(parsed.$inner);
485
- break;
486
- }
487
- case 'ZodTuple': {
488
- schema.type = 'array';
489
- schema.items = parsed.$inner
490
- .map(t => getSwaggerSchema(t))
491
- .filter(t => !!t);
492
- break;
493
- }
494
- case 'ZodObject': {
495
- schema.type = 'object';
496
- schema.properties = {};
497
- schema.required = [];
498
- if (zodType._def.unknownKeys === 'passthrough') {
499
- schema.additionalProperties = {};
500
- }
501
- for (const [key, val] of Object.entries(parsed.$inner)) {
502
- const prop = getSwaggerSchema(val);
503
- if (prop) {
504
- schema.properties[key] = prop;
505
- if (!val.$optional) {
506
- schema.required.push(key);
507
- }
508
- }
509
- }
510
- break;
511
- }
512
- case 'ZodPromise':
513
- case 'ZodRecord':
514
- case 'ZodMap':
515
- case 'ZodSet': {
516
- schema.type = 'object';
517
- schema.properties = {};
518
- schema.additionalProperties = parsed.$type === 'ZodRecord' ? {} : undefined;
519
- break;
520
- }
521
- case 'ZodUnion':
522
- case 'ZodDiscriminatedUnion': {
523
- schema.oneOf = parsed.$inner
524
- .map(t => getSwaggerSchema(t))
525
- .filter(t => !!t);
526
- break;
527
- }
528
- case 'ZodIntersection': {
529
- schema.allOf = parsed.$inner
530
- .map(t => getSwaggerSchema(t))
531
- .filter(t => !!t);
532
- break;
533
- }
534
- case 'ZodLazy': {
535
- return getSwaggerSchema(parsed.$get());
536
- }
537
- }
538
- }
539
- if (parsed.$nullable) {
540
- schema.nullable = parsed.$nullable;
541
- }
542
- if (parsed.$ref._def.description) {
543
- schema.description = parsed.$ref._def.description;
544
- }
545
- if (parsed.$checks) {
546
- const checks = parsed.$checks;
547
- if (parsed.$type === 'ZodString') {
548
- if (typeof checks.min === 'number') {
549
- schema.minLength = checks.min;
550
- }
551
- if (typeof checks.max === 'number') {
552
- schema.maxLength = checks.max;
553
- }
554
- }
555
- else {
556
- if (typeof checks.min === 'number') {
557
- schema.minimum = checks.min;
558
- }
559
- if (typeof checks.max === 'number') {
560
- schema.maximum = checks.max;
561
- }
562
- }
563
- }
564
- if (!forParam && zodType.__type_ref) {
565
- return { $ref: `#/components/schemas/${zodType.__type_ref.name}` };
566
- }
567
- return schema;
262
+ const zodType = parsed.$ref;
263
+ const meta = zodType.__type_ref ? getSwaggerMate().read(zodType.__type_ref) : undefined;
264
+ if (!forParam && zodType.__type_ref && globalSchemas[zodType.__type_ref.name]) return { $ref: `#/components/schemas/${zodType.__type_ref.name}` };
265
+ if (forParam && zodType.__type_ref && globalSchemas[zodType.__type_ref.name]) return globalSchemas[zodType.__type_ref.name];
266
+ const schema = {};
267
+ if (meta) {
268
+ if (meta.swaggerExample) schema.example = meta.swaggerExample;
269
+ if (meta.label || meta.id) schema.title = meta.label || meta.id;
270
+ if (meta.description) schema.description = meta.description;
271
+ }
272
+ if (!forParam && zodType.__type_ref) globalSchemas[zodType.__type_ref.name] = schema;
273
+ function asString() {
274
+ schema.type = "string";
275
+ if (parsed.$checks) {
276
+ const { regex } = parsed.$checks;
277
+ if (regex) schema.pattern = regex.source;
278
+ }
279
+ }
280
+ function asLiteral() {
281
+ if (parsed.$type === "ZodLiteral") {
282
+ schema.type = "string";
283
+ schema.enum = [parsed.$value];
284
+ }
285
+ }
286
+ function asEnum() {
287
+ if (parsed.$type === "ZodEnum") {
288
+ schema.type = "string";
289
+ schema.enum = parsed.$value;
290
+ }
291
+ }
292
+ function asNativeEnum() {
293
+ if (parsed.$type === "ZodNativeEnum") {
294
+ schema.type = "string";
295
+ schema.enum = Object.keys(parsed.$value);
296
+ }
297
+ }
298
+ if (forParam) switch (parsed.$type) {
299
+ case "ZodAny":
300
+ case "ZodUnknown":
301
+ case "ZodString": {
302
+ asString();
303
+ break;
304
+ }
305
+ case "ZodNumber": {
306
+ schema.type = "number";
307
+ break;
308
+ }
309
+ case "ZodBigInt": {
310
+ schema.type = "integer";
311
+ break;
312
+ }
313
+ case "ZodBoolean": {
314
+ schema.type = "boolean";
315
+ break;
316
+ }
317
+ case "ZodLiteral": {
318
+ asLiteral();
319
+ break;
320
+ }
321
+ case "ZodEnum": {
322
+ asEnum();
323
+ break;
324
+ }
325
+ case "ZodNativeEnum": {
326
+ asNativeEnum();
327
+ break;
328
+ }
329
+ case "ZodDate": {
330
+ schema.type = "string";
331
+ break;
332
+ }
333
+ case "ZodNull": {
334
+ schema.type = "null";
335
+ break;
336
+ }
337
+ default: return undefined;
338
+ }
339
+ else switch (parsed.$type) {
340
+ case "ZodString": {
341
+ asString();
342
+ break;
343
+ }
344
+ case "ZodNumber": {
345
+ schema.type = "number";
346
+ break;
347
+ }
348
+ case "ZodBigInt": {
349
+ schema.type = "integer";
350
+ break;
351
+ }
352
+ case "ZodBoolean": {
353
+ schema.type = "boolean";
354
+ break;
355
+ }
356
+ case "ZodLiteral": {
357
+ asLiteral();
358
+ break;
359
+ }
360
+ case "ZodEnum": {
361
+ asEnum();
362
+ break;
363
+ }
364
+ case "ZodNativeEnum": {
365
+ asNativeEnum();
366
+ break;
367
+ }
368
+ case "ZodDate": {
369
+ schema.type = "string";
370
+ break;
371
+ }
372
+ case "ZodNull": {
373
+ schema.type = "null";
374
+ break;
375
+ }
376
+ case "ZodFunction":
377
+ case "ZodSymbol":
378
+ case "ZodUndefined":
379
+ case "ZodUnknown":
380
+ case "ZodNever":
381
+ case "ZodVoid":
382
+ case "ZodNaN": return undefined;
383
+ case "ZodArray": {
384
+ schema.type = "array";
385
+ schema.minItems = parsed.$checks?.minLength || undefined;
386
+ schema.maxItems = parsed.$checks?.maxLength || undefined;
387
+ schema.items = getSwaggerSchema(parsed.$inner);
388
+ break;
389
+ }
390
+ case "ZodTuple": {
391
+ schema.type = "array";
392
+ schema.items = parsed.$inner.map((t) => getSwaggerSchema(t)).filter((t) => !!t);
393
+ break;
394
+ }
395
+ case "ZodObject": {
396
+ schema.type = "object";
397
+ schema.properties = {};
398
+ schema.required = [];
399
+ if (zodType._def.unknownKeys === "passthrough") schema.additionalProperties = {};
400
+ for (const [key, val] of Object.entries(parsed.$inner)) {
401
+ const prop = getSwaggerSchema(val);
402
+ if (prop) {
403
+ schema.properties[key] = prop;
404
+ if (!val.$optional) schema.required.push(key);
405
+ }
406
+ }
407
+ break;
408
+ }
409
+ case "ZodPromise":
410
+ case "ZodRecord":
411
+ case "ZodMap":
412
+ case "ZodSet": {
413
+ schema.type = "object";
414
+ schema.properties = {};
415
+ schema.additionalProperties = parsed.$type === "ZodRecord" ? {} : undefined;
416
+ break;
417
+ }
418
+ case "ZodUnion":
419
+ case "ZodDiscriminatedUnion": {
420
+ schema.oneOf = parsed.$inner.map((t) => getSwaggerSchema(t)).filter((t) => !!t);
421
+ break;
422
+ }
423
+ case "ZodIntersection": {
424
+ schema.allOf = parsed.$inner.map((t) => getSwaggerSchema(t)).filter((t) => !!t);
425
+ break;
426
+ }
427
+ case "ZodLazy": return getSwaggerSchema(parsed.$get());
428
+ }
429
+ if (parsed.$nullable) schema.nullable = parsed.$nullable;
430
+ if (parsed.$ref._def.description) schema.description = parsed.$ref._def.description;
431
+ if (parsed.$checks) {
432
+ const checks = parsed.$checks;
433
+ if (parsed.$type === "ZodString") {
434
+ if (typeof checks.min === "number") schema.minLength = checks.min;
435
+ if (typeof checks.max === "number") schema.maxLength = checks.max;
436
+ } else {
437
+ if (typeof checks.min === "number") schema.minimum = checks.min;
438
+ if (typeof checks.max === "number") schema.maximum = checks.max;
439
+ }
440
+ }
441
+ if (!forParam && zodType.__type_ref) return { $ref: `#/components/schemas/${zodType.__type_ref.name}` };
442
+ return schema;
568
443
  }
569
444
  function myParseZod(schema) {
570
- return parseZodType(schema);
445
+ return parseZodType(schema);
571
446
  }
572
447
  function getDefaultStatusCode(httpMethod) {
573
- const defaultStatusCodes = {
574
- GET: 200,
575
- PUT: 200,
576
- POST: 201,
577
- DELETE: 204,
578
- };
579
- return defaultStatusCodes[httpMethod.toUpperCase()] || 200;
448
+ const defaultStatusCodes = {
449
+ GET: 200,
450
+ PUT: 200,
451
+ POST: 201,
452
+ DELETE: 204
453
+ };
454
+ return defaultStatusCodes[httpMethod.toUpperCase()] || 200;
580
455
  }
581
456
  function getSwaggerSchemaFromSwaggerConfigType(type) {
582
- let schema;
583
- let zt;
584
- if (type instanceof z.ZodType) {
585
- zt = type;
586
- }
587
- else if (typeof type === 'function') {
588
- zt = getZodType({
589
- type,
590
- });
591
- }
592
- if (zt) {
593
- const parsed = myParseZod(zt);
594
- if (['ZodString', 'ZodNumber', 'ZodObject', 'ZodArray', 'ZodBoolean'].includes(parsed.$type)) {
595
- schema = getSwaggerSchema(parsed);
596
- }
597
- }
598
- else if (type.type || type.$ref) {
599
- schema = type;
600
- }
601
- return schema;
457
+ let schema;
458
+ let zt;
459
+ if (type instanceof z.ZodType) zt = type;
460
+ else if (typeof type === "function") zt = getZodType({ type });
461
+ if (zt) {
462
+ const parsed = myParseZod(zt);
463
+ if ([
464
+ "ZodString",
465
+ "ZodNumber",
466
+ "ZodObject",
467
+ "ZodArray",
468
+ "ZodBoolean"
469
+ ].includes(parsed.$type)) schema = getSwaggerSchema(parsed);
470
+ } else if (type.type || type.$ref) schema = type;
471
+ return schema;
602
472
  }
603
473
 
604
- let SwaggerController = class SwaggerController {
605
- constructor(opts = { title: 'Moost API' }) {
606
- this.opts = opts;
607
- this['assetPath'] = getAbsoluteFSPath();
608
- }
609
- 'processCors'() {
610
- if (this.opts.cors) {
611
- const { enableCors } = useSetHeaders();
612
- enableCors(this.opts.cors === true ? undefined : this.opts.cors);
613
- }
614
- }
615
- 'serveIndex'(url, location, status) {
616
- this.processCors();
617
- if (!url.endsWith('index.html') && !url.endsWith('/')) {
618
- status.value = 302;
619
- location.value = Path.join(url, '/');
620
- return '';
621
- }
622
- return `<!DOCTYPE html>
474
+ //#endregion
475
+ //#region packages/swagger/src/swagger.controller.ts
476
+ function _define_property(obj, key, value) {
477
+ if (key in obj) Object.defineProperty(obj, key, {
478
+ value,
479
+ enumerable: true,
480
+ configurable: true,
481
+ writable: true
482
+ });
483
+ else obj[key] = value;
484
+ return obj;
485
+ }
486
+ function _ts_decorate(decorators, target, key, desc) {
487
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
488
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
489
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
490
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
491
+ }
492
+ function _ts_metadata(k, v) {
493
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
494
+ }
495
+ function _ts_param(paramIndex, decorator) {
496
+ return function(target, key) {
497
+ decorator(target, key, paramIndex);
498
+ };
499
+ }
500
+ var SwaggerController = class {
501
+ "processCors"() {
502
+ if (this.opts.cors) {
503
+ const { enableCors } = useSetHeaders();
504
+ enableCors(this.opts.cors === true ? undefined : this.opts.cors);
505
+ }
506
+ }
507
+ "serveIndex"(url, location, status) {
508
+ this.processCors();
509
+ if (!url.endsWith("index.html") && !url.endsWith("/")) {
510
+ status.value = 302;
511
+ location.value = Path.join(url, "/");
512
+ return "";
513
+ }
514
+ return `<!DOCTYPE html>
623
515
  <html lang="en">
624
516
  <head>
625
517
  <meta charset="UTF-8">
@@ -637,10 +529,10 @@ let SwaggerController = class SwaggerController {
637
529
  <script src="./swagger-initializer.js" charset="UTF-8"> </script>
638
530
  </body>
639
531
  </html>`;
640
- }
641
- 'swagger-initializer.js'() {
642
- this.processCors();
643
- return `window.onload = function() {
532
+ }
533
+ "swagger-initializer.js"() {
534
+ this.processCors();
535
+ return `window.onload = function() {
644
536
  window.ui = SwaggerUIBundle({
645
537
  url: "./spec.json",
646
538
  dom_id: '#swagger-ui',
@@ -655,72 +547,85 @@ let SwaggerController = class SwaggerController {
655
547
  layout: "BaseLayout"
656
548
  });
657
549
  };`;
658
- }
659
- async 'spec.json'() {
660
- this.processCors();
661
- const logger = useEventLogger('@moostjs/zod');
662
- if (!this.spec) {
663
- const { instantiate } = useControllerContext();
664
- const moost = await instantiate(Moost);
665
- this.spec = mapToSwaggerSpec(moost.getControllersOverview(), this.opts, logger);
666
- }
667
- return this.spec;
668
- }
669
- 'files'(url) {
670
- this.processCors();
671
- return this.serve(url.split('/').pop());
672
- }
673
- 'serve'(path) {
674
- return serveFile(path, {
675
- baseDir: this.assetPath,
676
- cacheControl: {
677
- public: true,
678
- maxAge: '1w',
679
- },
680
- });
681
- }
550
+ }
551
+ async "spec.json"() {
552
+ this.processCors();
553
+ const logger = useEventLogger("@moostjs/zod");
554
+ if (!this.spec) {
555
+ const { instantiate } = useControllerContext();
556
+ const moost = await instantiate(Moost);
557
+ this.spec = mapToSwaggerSpec(moost.getControllersOverview(), this.opts, logger);
558
+ }
559
+ return this.spec;
560
+ }
561
+ "files"(url) {
562
+ this.processCors();
563
+ return this.serve(url.split("/").pop());
564
+ }
565
+ "serve"(path) {
566
+ return serveFile(path, {
567
+ baseDir: this.assetPath,
568
+ cacheControl: {
569
+ public: true,
570
+ maxAge: "1w"
571
+ }
572
+ });
573
+ }
574
+ constructor(opts = { title: "Moost API" }) {
575
+ _define_property(this, "opts", void 0);
576
+ _define_property(this, "assetPath", void 0);
577
+ _define_property(this, "spec", void 0);
578
+ this.opts = opts;
579
+ this["assetPath"] = getAbsoluteFSPath();
580
+ }
682
581
  };
683
- __decorate([
684
- Get(''),
685
- Get('//'),
686
- Get('index.html'),
687
- SetHeader('content-type', 'text/html'),
688
- __param(0, Url()),
689
- __param(1, HeaderHook('location')),
690
- __param(2, StatusHook()),
691
- __metadata("design:type", Function),
692
- __metadata("design:paramtypes", [String, Object, Object]),
693
- __metadata("design:returntype", void 0)
582
+ _ts_decorate([
583
+ Get(""),
584
+ Get("//"),
585
+ Get("index.html"),
586
+ SetHeader("content-type", "text/html"),
587
+ _ts_param(0, Url()),
588
+ _ts_param(1, HeaderHook("location")),
589
+ _ts_param(2, StatusHook()),
590
+ _ts_metadata("design:type", Function),
591
+ _ts_metadata("design:paramtypes", [
592
+ String,
593
+ typeof THeaderHook === "undefined" ? Object : THeaderHook,
594
+ typeof TStatusHook === "undefined" ? Object : TStatusHook
595
+ ]),
596
+ _ts_metadata("design:returntype", void 0)
694
597
  ], SwaggerController.prototype, "serveIndex", null);
695
- __decorate([
696
- Get(),
697
- SetHeader('content-type', 'application/javascript'),
698
- __metadata("design:type", Function),
699
- __metadata("design:paramtypes", []),
700
- __metadata("design:returntype", void 0)
598
+ _ts_decorate([
599
+ Get(),
600
+ SetHeader("content-type", "application/javascript"),
601
+ _ts_metadata("design:type", Function),
602
+ _ts_metadata("design:paramtypes", []),
603
+ _ts_metadata("design:returntype", void 0)
701
604
  ], SwaggerController.prototype, "swagger-initializer.js", null);
702
- __decorate([
703
- Get(),
704
- __metadata("design:type", Function),
705
- __metadata("design:paramtypes", []),
706
- __metadata("design:returntype", Promise)
605
+ _ts_decorate([
606
+ Get(),
607
+ _ts_metadata("design:type", Function),
608
+ _ts_metadata("design:paramtypes", []),
609
+ _ts_metadata("design:returntype", Promise)
707
610
  ], SwaggerController.prototype, "spec.json", null);
708
- __decorate([
709
- Get('swagger-ui-bundle.*(js|js\\.map)'),
710
- Get('swagger-ui-standalone-preset.*(js|js\\.map)'),
711
- Get('swagger-ui.*(css|css\\.map)'),
712
- Get('index.*(css|css\\.map)'),
713
- __param(0, Url()),
714
- __metadata("design:type", Function),
715
- __metadata("design:paramtypes", [String]),
716
- __metadata("design:returntype", void 0)
611
+ _ts_decorate([
612
+ Get("swagger-ui-bundle.*(js|js\\.map)"),
613
+ Get("swagger-ui-standalone-preset.*(js|js\\.map)"),
614
+ Get("swagger-ui.*(css|css\\.map)"),
615
+ Get("index.*(css|css\\.map)"),
616
+ _ts_param(0, Url()),
617
+ _ts_metadata("design:type", Function),
618
+ _ts_metadata("design:paramtypes", [String]),
619
+ _ts_metadata("design:returntype", void 0)
717
620
  ], SwaggerController.prototype, "files", null);
718
- SwaggerController = __decorate([
719
- SwaggerExclude(),
720
- ZodSkip(),
721
- Controller('api-docs'),
722
- __param(0, Const({ title: 'Moost API' })),
723
- __metadata("design:paramtypes", [Object])
621
+ SwaggerController = _ts_decorate([
622
+ SwaggerExclude(),
623
+ ZodSkip(),
624
+ Controller("api-docs"),
625
+ _ts_param(0, Const({ title: "Moost API" })),
626
+ _ts_metadata("design:type", Function),
627
+ _ts_metadata("design:paramtypes", [typeof TSwaggerOptions === "undefined" ? Object : TSwaggerOptions])
724
628
  ], SwaggerController);
725
629
 
726
- export { SwaggerController, SwaggerDescription, SwaggerExample, SwaggerExclude, SwaggerParam, SwaggerRequestBody, SwaggerResponse, SwaggerTag, getSwaggerMate };
630
+ //#endregion
631
+ export { SwaggerController, SwaggerDescription, SwaggerExample, SwaggerExclude, SwaggerParam, SwaggerRequestBody, SwaggerResponse, SwaggerTag, getSwaggerMate };