@tsed/swagger 7.0.0-beta.2 → 7.0.0-beta.20

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 (63) hide show
  1. package/jest.config.js +14 -0
  2. package/lib/cjs/SwaggerModule.js +32 -28
  3. package/lib/cjs/SwaggerModule.js.map +1 -1
  4. package/lib/cjs/index.js +15 -5
  5. package/lib/cjs/index.js.map +1 -1
  6. package/lib/cjs/interfaces/SwaggerSettings.js.map +1 -1
  7. package/lib/cjs/interfaces/interfaces.js +3 -0
  8. package/lib/cjs/interfaces/interfaces.js.map +1 -0
  9. package/lib/cjs/middlewares/cssMiddleware.js +1 -1
  10. package/lib/cjs/middlewares/cssMiddleware.js.map +1 -1
  11. package/lib/cjs/middlewares/jsMiddleware.js +1 -1
  12. package/lib/cjs/middlewares/jsMiddleware.js.map +1 -1
  13. package/lib/cjs/package.json +3 -0
  14. package/lib/cjs/services/SwaggerService.js +23 -83
  15. package/lib/cjs/services/SwaggerService.js.map +1 -1
  16. package/lib/cjs/utils/includeRoute.js +2 -2
  17. package/lib/cjs/utils/includeRoute.js.map +1 -1
  18. package/lib/cjs/utils/matchPath.js +1 -1
  19. package/lib/cjs/utils/matchPath.js.map +1 -1
  20. package/lib/esm/SwaggerModule.js +25 -21
  21. package/lib/esm/SwaggerModule.js.map +1 -1
  22. package/lib/esm/index.js +15 -5
  23. package/lib/esm/index.js.map +1 -1
  24. package/lib/esm/interfaces/SwaggerSettings.js.map +1 -1
  25. package/lib/esm/interfaces/interfaces.js +2 -0
  26. package/lib/esm/interfaces/interfaces.js.map +1 -0
  27. package/lib/esm/package.json +3 -0
  28. package/lib/esm/services/SwaggerService.js +23 -83
  29. package/lib/esm/services/SwaggerService.js.map +1 -1
  30. package/lib/esm/utils/includeRoute.js +1 -1
  31. package/lib/esm/utils/includeRoute.js.map +1 -1
  32. package/lib/types/SwaggerModule.d.ts +3 -2
  33. package/lib/types/index.d.ts +12 -2
  34. package/lib/types/interfaces/SwaggerSettings.d.ts +9 -2
  35. package/lib/types/interfaces/{index.d.ts → interfaces.d.ts} +0 -1
  36. package/lib/types/services/SwaggerService.d.ts +6 -16
  37. package/lib/types/utils/includeRoute.d.ts +3 -3
  38. package/package.json +30 -21
  39. package/readme.md +74 -87
  40. package/lib/cjs/interfaces/index.js +0 -5
  41. package/lib/cjs/interfaces/index.js.map +0 -1
  42. package/lib/cjs/utils/index.js +0 -9
  43. package/lib/cjs/utils/index.js.map +0 -1
  44. package/lib/cjs/utils/mapOpenSpec.js +0 -29
  45. package/lib/cjs/utils/mapOpenSpec.js.map +0 -1
  46. package/lib/cjs/utils/mapOpenSpec3.js +0 -26
  47. package/lib/cjs/utils/mapOpenSpec3.js.map +0 -1
  48. package/lib/cjs/utils/mapOpenSpecInfo.js +0 -21
  49. package/lib/cjs/utils/mapOpenSpecInfo.js.map +0 -1
  50. package/lib/esm/interfaces/index.js +0 -2
  51. package/lib/esm/interfaces/index.js.map +0 -1
  52. package/lib/esm/utils/index.js +0 -6
  53. package/lib/esm/utils/index.js.map +0 -1
  54. package/lib/esm/utils/mapOpenSpec.js +0 -25
  55. package/lib/esm/utils/mapOpenSpec.js.map +0 -1
  56. package/lib/esm/utils/mapOpenSpec3.js +0 -22
  57. package/lib/esm/utils/mapOpenSpec3.js.map +0 -1
  58. package/lib/esm/utils/mapOpenSpecInfo.js +0 -17
  59. package/lib/esm/utils/mapOpenSpecInfo.js.map +0 -1
  60. package/lib/types/utils/index.d.ts +0 -5
  61. package/lib/types/utils/mapOpenSpec.d.ts +0 -10
  62. package/lib/types/utils/mapOpenSpec3.d.ts +0 -8
  63. package/lib/types/utils/mapOpenSpecInfo.d.ts +0 -6
package/readme.md CHANGED
@@ -11,7 +11,8 @@
11
11
  [![npm version](https://badge.fury.io/js/%40tsed%2Fcommon.svg)](https://badge.fury.io/js/%40tsed%2Fcommon)
12
12
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
13
13
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
14
- [![backers](https://opencollective.com/tsed/tiers/badge.svg)](https://opencollective.com/tsed)
14
+ [![github](https://img.shields.io/static/v1?label=Github%20sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/romakita)
15
+ [![opencollective](https://img.shields.io/static/v1?label=OpenCollective%20sponsor&message=%E2%9D%A4&logo=OpenCollective&color=%23fe8e86)](https://opencollective.com/tsed)
15
16
 
16
17
  </div>
17
18
 
@@ -43,25 +44,22 @@ Then add the following configuration in your Server:
43
44
  import {Configuration} from "@tsed/common";
44
45
  import "@tsed/swagger"; // import swagger Ts.ED module
45
46
  import {resolve} from "path";
46
- const rootDir = resolve(__dirname)
47
47
 
48
48
  @Configuration({
49
- rootDir,
50
49
  swagger: [
51
50
  {
52
- path: "/v2/docs",
53
- specVersion: "2.0"
51
+ path: "/v2/docs",
52
+ specVersion: "2.0"
54
53
  },
55
54
  {
56
- path: "/v3/docs",
57
- specVersion: "3.0.1"
55
+ path: "/v3/docs",
56
+ specVersion: "3.0.1"
58
57
  }
59
58
  ]
60
59
  })
61
- export class Server {
62
-
63
- }
60
+ export class Server {}
64
61
  ```
62
+
65
63
  > The path option for swagger will be used to expose the documentation (ex: http://localhost:8000/api-docs).
66
64
 
67
65
  Normally, Swagger-ui is ready. You can start your server and check if it work fine.
@@ -72,21 +70,21 @@ Normally, Swagger-ui is ready. You can start your server and check if it work fi
72
70
 
73
71
  Some options is available to configure Swagger-ui, Ts.ED and the default spec information.
74
72
 
75
- Key | Example | Description
76
- ---|---|---
77
- path | `/api-doc` | The url subpath to access to the documentation.
78
- specVersion | `2.0`, `3.0.1` | The spec version.
79
- doc | `hidden-doc` | The documentation key used by `@Docs` decorator to create several swagger documentations.
80
- cssPath | `${rootDir}/spec/style.css` | The path to the CSS file.
81
- jsPath | `${rootDir}/spec/main.js` | The path to the JS file.
82
- showExplorer | `true` | Display the search field in the navbar.
83
- spec | `{swagger: "2.0"}` | The default information spec.
84
- specPath | `${rootDir}/spec/swagger.base.json` | Load the base spec documentation from the specified path.
85
- outFile | `${rootDir}/spec/swagger.json` | Write the `swagger.json` spec documentation on the specified path.
86
- hidden | `true` | Hide the documentation in the dropdown explorer list.
87
- options | Swagger-UI options | SwaggerUI options. See (https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md)
88
- operationIdFormatter | `(name: string, propertyKey: string, path: string) => string` | A function to generate the operationId.
89
- operationIdPattern | `%c_%m` | A pattern to generate the operationId. Format of operationId field (%c: class name, %m: method name).
73
+ | Key | Example | Description |
74
+ | -------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
75
+ | path | `/api-doc` | The url subpath to access to the documentation. |
76
+ | specVersion | `2.0`, `3.0.1` | The spec version. |
77
+ | doc | `hidden-doc` | The documentation key used by `@Docs` decorator to create several swagger documentations. |
78
+ | cssPath | `${rootDir}/spec/style.css` | The path to the CSS file. |
79
+ | jsPath | `${rootDir}/spec/main.js` | The path to the JS file. |
80
+ | showExplorer | `true` | Display the search field in the navbar. |
81
+ | spec | `{swagger: "2.0"}` | The default information spec. |
82
+ | specPath | `${rootDir}/spec/swagger.base.json` | Load the base spec documentation from the specified path. |
83
+ | outFile | `${rootDir}/spec/swagger.json` | Write the `swagger.json` spec documentation on the specified path. |
84
+ | hidden | `true` | Hide the documentation in the dropdown explorer list. |
85
+ | options | Swagger-UI options | SwaggerUI options. See (https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md) |
86
+ | operationIdFormatter | `(name: string, propertyKey: string, path: string) => string` | A function to generate the operationId. |
87
+ | operationIdPattern | `%c_%m` | A pattern to generate the operationId. Format of operationId field (%c: class name, %m: method name). |
90
88
 
91
89
  ### Multi documentations
92
90
 
@@ -97,21 +95,18 @@ import {Configuration} from "@tsed/common";
97
95
  import "@tsed/swagger"; // import swagger Ts.ED module
98
96
 
99
97
  @Configuration({
100
- rootDir: __dirname,
101
98
  swagger: [
102
99
  {
103
100
  path: "/api-docs-v1",
104
- doc: 'api-v1'
101
+ doc: "api-v1"
105
102
  },
106
103
  {
107
104
  path: "/api-docs-v2",
108
- doc: 'api-v2'
105
+ doc: "api-v2"
109
106
  }
110
107
  ]
111
108
  })
112
- export class Server {
113
-
114
- }
109
+ export class Server {}
115
110
  ```
116
111
 
117
112
  Then use `@Docs` decorators on your controllers to specify where the controllers should be displayed.
@@ -120,19 +115,17 @@ Then use `@Docs` decorators on your controllers to specify where the controllers
120
115
  import {Controller} from "@tsed/common";
121
116
  import {Docs} from "@tsed/swagger";
122
117
 
123
- @Controller('/calendars')
124
- @Docs('api-v2') // display this controllers only for api-docs-v2
125
- export class CalendarCtrlV2 {
126
- }
127
- // OR
128
- @Controller('/calendars')
129
- @Docs('api-v2', 'api-v1') // display this controllers for api-docs-v2 and api-docs-v1
130
- export class CalendarCtrl {
131
-
132
- }
133
- ```
118
+ @Controller("/calendars")
119
+ @Docs("api-v2") // display this controllers only for api-docs-v2
120
+ export class CalendarCtrlV2 {}
121
+ // OR
122
+ @Controller("/calendars")
123
+ @Docs("api-v2", "api-v1") // display this controllers for api-docs-v2 and api-docs-v1
124
+ export class CalendarCtrl {}
125
+ ```
134
126
 
135
127
  ## Examples
128
+
136
129
  #### Model documentation
137
130
 
138
131
  One of the feature of Ts.ED is the model definition to serialize or deserialize a
@@ -162,57 +155,55 @@ import {BodyParams, Controller, Get, Post, QueryParams, Returns, ReturnsArray, D
162
155
  import {Summary, Deprecated, Security} from "@tsed/swagger";
163
156
  import {CalendarModel} from "../models/CalendarModel";
164
157
 
165
- @Controller('/calendars')
158
+ @Controller("/calendars")
166
159
  export class Calendar {
167
- @Get('/:id')
168
- @Summary("Summary of this route")
169
- @Description("Description of this route")
170
- @Returns(CalendarModel)
171
- @Returns(404, {description: "Not found"})
172
- async getCalendar(@QueryParams('id') id: string): Promise<CalendarModel> {
173
- //...
174
- }
175
-
176
- @Get('/v0/:id')
177
- @Deprecated()
178
- @Description("Deprecated route, use /rest/calendars/:id instead of.")
179
- @Returns(CalendarModel)
180
- @Returns(404, {description: "Not found"})
181
- getCalendarDeprecated(@QueryParams('id') id: string): Promise<CalendarModel> {
182
- //...
183
- }
184
-
185
- @Get('/')
186
- @Description("Description of this route")
187
- @ReturnsArray(CalendarModel)
188
- getCalendars(): Promise<CalendarModel[]> {
189
- // ...
190
- }
191
-
192
- @Post('/')
193
- @Security("calendar_auth", "write:calendar", "read:calendar")
194
- @Returns(CalendarModel)
195
- async createCalendar(@BodyParams() body: any): Promise<CalendarModel> {
196
- //...
197
- }
160
+ @Get("/:id")
161
+ @Summary("Summary of this route")
162
+ @Description("Description of this route")
163
+ @Returns(CalendarModel)
164
+ @Returns(404, {description: "Not found"})
165
+ async getCalendar(@QueryParams("id") id: string): Promise<CalendarModel> {
166
+ //...
167
+ }
168
+
169
+ @Get("/v0/:id")
170
+ @Deprecated()
171
+ @Description("Deprecated route, use /rest/calendars/:id instead of.")
172
+ @Returns(CalendarModel)
173
+ @Returns(404, {description: "Not found"})
174
+ getCalendarDeprecated(@QueryParams("id") id: string): Promise<CalendarModel> {
175
+ //...
176
+ }
177
+
178
+ @Get("/")
179
+ @Description("Description of this route")
180
+ @ReturnsArray(CalendarModel)
181
+ getCalendars(): Promise<CalendarModel[]> {
182
+ // ...
183
+ }
184
+
185
+ @Post("/")
186
+ @Security("calendar_auth", "write:calendar", "read:calendar")
187
+ @Returns(CalendarModel)
188
+ async createCalendar(@BodyParams() body: any): Promise<CalendarModel> {
189
+ //...
190
+ }
198
191
  }
199
192
  ```
193
+
200
194
  ::: warninig
201
195
  To update the swagger.json you need to reload the server before.
202
196
  :::
203
197
 
204
-
205
198
  ## Import Javascript
206
199
 
207
- It possible to import a Javascript in the Swagger-ui documentation. This script let you customize the swagger-ui instance.
208
-
200
+ It possible to import a Javascript in the Swagger-ui documentation. This script let you customize the swagger-ui instance.
209
201
 
210
202
  ```typescript
211
203
  import {Configuration} from "@tsed/common";
212
204
  import "@tsed/swagger"; // import swagger Ts.ED module
213
205
 
214
206
  @Configuration({
215
- rootDir: __dirname,
216
207
  swagger: [
217
208
  {
218
209
  path: "/api-docs",
@@ -220,9 +211,7 @@ import "@tsed/swagger"; // import swagger Ts.ED module
220
211
  }
221
212
  ]
222
213
  })
223
- export class Server {
224
-
225
- }
214
+ export class Server {}
226
215
  ```
227
216
 
228
217
  In your JavaScript file, you can handle Swagger-ui configuration and the instance:
@@ -230,8 +219,8 @@ In your JavaScript file, you can handle Swagger-ui configuration and the instanc
230
219
  ```javascript
231
220
  console.log(SwaggerUIBuilder.config); //Swagger-ui config
232
221
 
233
- document.addEventListener('swagger.init', (evt) => {
234
- console.log(SwaggerUIBuilder.ui); //Swagger-ui instance
222
+ document.addEventListener("swagger.init", (evt) => {
223
+ console.log(SwaggerUIBuilder.ui); //Swagger-ui instance
235
224
  });
236
225
  ```
237
226
 
@@ -239,20 +228,18 @@ document.addEventListener('swagger.init', (evt) => {
239
228
 
240
229
  See our documentation https://tsed.io/#/api/index
241
230
 
242
-
243
231
  ## Contributors
232
+
244
233
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html).
245
234
 
246
235
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
247
236
 
248
-
249
237
  ## Backers
250
238
 
251
239
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
252
240
 
253
241
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
254
242
 
255
-
256
243
  ## Sponsors
257
244
 
258
245
  Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
@@ -261,7 +248,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
261
248
 
262
249
  The MIT License (MIT)
263
250
 
264
- Copyright (c) 2016 - 2018 Romain Lenzotti
251
+ Copyright (c) 2016 - 2022 Romain Lenzotti
265
252
 
266
253
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
267
254
 
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./SwaggerSettings"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAUA,iEAAkC","sourcesContent":["import {SwaggerSettings} from \"./SwaggerSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n swagger: SwaggerSettings[];\n }\n }\n}\n\nexport * from \"./SwaggerSettings\";\n"]}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./mapOpenSpec"), exports);
5
- (0, tslib_1.__exportStar)(require("./mapOpenSpec3"), exports);
6
- (0, tslib_1.__exportStar)(require("./mapOpenSpecInfo"), exports);
7
- (0, tslib_1.__exportStar)(require("./mapOpenSpecInfo"), exports);
8
- (0, tslib_1.__exportStar)(require("./matchPath"), exports);
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAC9B,8DAA+B;AAC/B,iEAAkC;AAClC,iEAAkC;AAClC,2DAA4B","sourcesContent":["export * from \"./mapOpenSpec\";\nexport * from \"./mapOpenSpec3\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./matchPath\";\n"]}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapOpenSpec = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- const mapOpenSpec3_1 = require("./mapOpenSpec3");
7
- /**
8
- * @ignore
9
- * @param spec
10
- * @param fileSpec
11
- * @param version
12
- * @param acceptMimes
13
- * @param specVersion
14
- */
15
- function mapOpenSpec(spec, { fileSpec, acceptMimes, specVersion, version }) {
16
- specVersion = specVersion || (0, core_1.getValue)(spec, "openapi", "3.0.1");
17
- const options = {
18
- specVersion,
19
- acceptMimes
20
- };
21
- spec = (0, mapOpenSpec3_1.mapOpenSpec3)(spec, options);
22
- fileSpec = fileSpec ? (0, mapOpenSpec3_1.mapOpenSpec3)(fileSpec, options) : fileSpec;
23
- spec = (0, schema_1.mergeSpec)(spec, fileSpec);
24
- (0, core_1.setValue)(spec, "info.title", (0, core_1.getValue)(spec, "info.title", "Api documentation"));
25
- (0, core_1.setValue)(spec, "info.version", (0, core_1.getValue)(spec, "info.version", version));
26
- return spec;
27
- }
28
- exports.mapOpenSpec = mapOpenSpec;
29
- //# sourceMappingURL=mapOpenSpec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpec.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAE9C,yCAAuC;AACvC,iDAA4C;AAE5C;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,IAAS,EAAE,EAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAM;IACvF,WAAW,GAAG,WAAW,IAAI,IAAA,eAAQ,EAAmB,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAElF,MAAM,OAAO,GAAG;QACd,WAAW;QACX,WAAW;KACZ,CAAC;IAEF,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,2BAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEjE,IAAI,GAAG,IAAA,kBAAS,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEjC,IAAA,eAAQ,EAAC,IAAI,EAAE,YAAY,EAAE,IAAA,eAAQ,EAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAChF,IAAA,eAAQ,EAAC,IAAI,EAAE,cAAc,EAAE,IAAA,eAAQ,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,OAAO,IAAI,CAAC;AACd,CAAC;AAjBD,kCAiBC","sourcesContent":["import {getValue, setValue} from \"@tsed/core\";\nimport {OpenSpec3, OpenSpecVersions} from \"@tsed/openspec\";\nimport {mergeSpec} from \"@tsed/schema\";\nimport {mapOpenSpec3} from \"./mapOpenSpec3\";\n\n/**\n * @ignore\n * @param spec\n * @param fileSpec\n * @param version\n * @param acceptMimes\n * @param specVersion\n */\nexport function mapOpenSpec(spec: any, {fileSpec, acceptMimes, specVersion, version}: any): Partial<OpenSpec3> {\n specVersion = specVersion || getValue<OpenSpecVersions>(spec, \"openapi\", \"3.0.1\");\n\n const options = {\n specVersion,\n acceptMimes\n };\n\n spec = mapOpenSpec3(spec, options);\n fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;\n\n spec = mergeSpec(spec, fileSpec);\n\n setValue(spec, \"info.title\", getValue(spec, \"info.title\", \"Api documentation\"));\n setValue(spec, \"info.version\", getValue(spec, \"info.version\", version));\n\n return spec;\n}\n"]}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapOpenSpec3 = void 0;
4
- const core_1 = require("@tsed/core");
5
- const mapOpenSpecInfo_1 = require("./mapOpenSpecInfo");
6
- /**
7
- * @ignore
8
- * @param spec
9
- * @param version
10
- * @param specVersion
11
- */
12
- function mapOpenSpec3(spec, { specVersion }) {
13
- const { servers, paths, components, security, tags, externalDocs } = spec;
14
- return {
15
- openapi: specVersion,
16
- info: (0, mapOpenSpecInfo_1.mapOpenSpecInfo)((0, core_1.getValue)(spec, "info", {})),
17
- servers,
18
- paths,
19
- components,
20
- security,
21
- tags,
22
- externalDocs
23
- };
24
- }
25
- exports.mapOpenSpec3 = mapOpenSpec3;
26
- //# sourceMappingURL=mapOpenSpec3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpec3.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec3.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC,uDAAkD;AAElD;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,IAAS,EAAE,EAAC,WAAW,EAAM;IACxD,MAAM,EAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAC,GAAG,IAAI,CAAC;IAExE,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,IAAA,iCAAe,EAAC,IAAA,eAAQ,EAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACjD,OAAO;QACP,KAAK;QACL,UAAU;QACV,QAAQ;QACR,IAAI;QACJ,YAAY;KACb,CAAC;AACJ,CAAC;AAbD,oCAaC","sourcesContent":["import {getValue} from \"@tsed/core\";\nimport {OpenSpec3} from \"@tsed/openspec\";\nimport {mapOpenSpecInfo} from \"./mapOpenSpecInfo\";\n\n/**\n * @ignore\n * @param spec\n * @param version\n * @param specVersion\n */\nexport function mapOpenSpec3(spec: any, {specVersion}: any): Partial<OpenSpec3> {\n const {servers, paths, components, security, tags, externalDocs} = spec;\n\n return {\n openapi: specVersion,\n info: mapOpenSpecInfo(getValue(spec, \"info\", {})),\n servers,\n paths,\n components,\n security,\n tags,\n externalDocs\n };\n}\n"]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapOpenSpecInfo = void 0;
4
- const core_1 = require("@tsed/core");
5
- /**
6
- * @ignore
7
- * @param info
8
- */
9
- function mapOpenSpecInfo(info) {
10
- const { title, description, version, termsOfService, contact, license } = info;
11
- return (0, core_1.cleanObject)({
12
- version,
13
- title,
14
- description,
15
- termsOfService,
16
- contact,
17
- license
18
- });
19
- }
20
- exports.mapOpenSpecInfo = mapOpenSpecInfo;
21
- //# sourceMappingURL=mapOpenSpecInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpecInfo.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpecInfo.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAGvC;;;GAGG;AACH,SAAgB,eAAe,CAAC,IAA2B;IACzD,MAAM,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC;IAE7E,OAAO,IAAA,kBAAW,EAAC;QACjB,OAAO;QACP,KAAK;QACL,WAAW;QACX,cAAc;QACd,OAAO;QACP,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAXD,0CAWC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {OpenSpecInfo} from \"@tsed/openspec\";\n\n/**\n * @ignore\n * @param info\n */\nexport function mapOpenSpecInfo(info: Partial<OpenSpecInfo>): OpenSpecInfo {\n const {title, description, version, termsOfService, contact, license} = info;\n\n return cleanObject({\n version,\n title,\n description,\n termsOfService,\n contact,\n license\n });\n}\n"]}
@@ -1,2 +0,0 @@
1
- export * from "./SwaggerSettings";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAUA,cAAc,mBAAmB,CAAC","sourcesContent":["import {SwaggerSettings} from \"./SwaggerSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n swagger: SwaggerSettings[];\n }\n }\n}\n\nexport * from \"./SwaggerSettings\";\n"]}
@@ -1,6 +0,0 @@
1
- export * from "./mapOpenSpec";
2
- export * from "./mapOpenSpec3";
3
- export * from "./mapOpenSpecInfo";
4
- export * from "./mapOpenSpecInfo";
5
- export * from "./matchPath";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./mapOpenSpec\";\nexport * from \"./mapOpenSpec3\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./matchPath\";\n"]}
@@ -1,25 +0,0 @@
1
- import { getValue, setValue } from "@tsed/core";
2
- import { mergeSpec } from "@tsed/schema";
3
- import { mapOpenSpec3 } from "./mapOpenSpec3";
4
- /**
5
- * @ignore
6
- * @param spec
7
- * @param fileSpec
8
- * @param version
9
- * @param acceptMimes
10
- * @param specVersion
11
- */
12
- export function mapOpenSpec(spec, { fileSpec, acceptMimes, specVersion, version }) {
13
- specVersion = specVersion || getValue(spec, "openapi", "3.0.1");
14
- const options = {
15
- specVersion,
16
- acceptMimes
17
- };
18
- spec = mapOpenSpec3(spec, options);
19
- fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;
20
- spec = mergeSpec(spec, fileSpec);
21
- setValue(spec, "info.title", getValue(spec, "info.title", "Api documentation"));
22
- setValue(spec, "info.version", getValue(spec, "info.version", version));
23
- return spec;
24
- }
25
- //# sourceMappingURL=mapOpenSpec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpec.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAS,EAAE,EAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAM;IACvF,WAAW,GAAG,WAAW,IAAI,QAAQ,CAAmB,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAElF,MAAM,OAAO,GAAG;QACd,WAAW;QACX,WAAW;KACZ,CAAC;IAEF,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEjE,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEjC,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAChF,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {getValue, setValue} from \"@tsed/core\";\nimport {OpenSpec3, OpenSpecVersions} from \"@tsed/openspec\";\nimport {mergeSpec} from \"@tsed/schema\";\nimport {mapOpenSpec3} from \"./mapOpenSpec3\";\n\n/**\n * @ignore\n * @param spec\n * @param fileSpec\n * @param version\n * @param acceptMimes\n * @param specVersion\n */\nexport function mapOpenSpec(spec: any, {fileSpec, acceptMimes, specVersion, version}: any): Partial<OpenSpec3> {\n specVersion = specVersion || getValue<OpenSpecVersions>(spec, \"openapi\", \"3.0.1\");\n\n const options = {\n specVersion,\n acceptMimes\n };\n\n spec = mapOpenSpec3(spec, options);\n fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;\n\n spec = mergeSpec(spec, fileSpec);\n\n setValue(spec, \"info.title\", getValue(spec, \"info.title\", \"Api documentation\"));\n setValue(spec, \"info.version\", getValue(spec, \"info.version\", version));\n\n return spec;\n}\n"]}
@@ -1,22 +0,0 @@
1
- import { getValue } from "@tsed/core";
2
- import { mapOpenSpecInfo } from "./mapOpenSpecInfo";
3
- /**
4
- * @ignore
5
- * @param spec
6
- * @param version
7
- * @param specVersion
8
- */
9
- export function mapOpenSpec3(spec, { specVersion }) {
10
- const { servers, paths, components, security, tags, externalDocs } = spec;
11
- return {
12
- openapi: specVersion,
13
- info: mapOpenSpecInfo(getValue(spec, "info", {})),
14
- servers,
15
- paths,
16
- components,
17
- security,
18
- tags,
19
- externalDocs
20
- };
21
- }
22
- //# sourceMappingURL=mapOpenSpec3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpec3.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAS,EAAE,EAAC,WAAW,EAAM;IACxD,MAAM,EAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAC,GAAG,IAAI,CAAC;IAExE,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACjD,OAAO;QACP,KAAK;QACL,UAAU;QACV,QAAQ;QACR,IAAI;QACJ,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import {getValue} from \"@tsed/core\";\nimport {OpenSpec3} from \"@tsed/openspec\";\nimport {mapOpenSpecInfo} from \"./mapOpenSpecInfo\";\n\n/**\n * @ignore\n * @param spec\n * @param version\n * @param specVersion\n */\nexport function mapOpenSpec3(spec: any, {specVersion}: any): Partial<OpenSpec3> {\n const {servers, paths, components, security, tags, externalDocs} = spec;\n\n return {\n openapi: specVersion,\n info: mapOpenSpecInfo(getValue(spec, \"info\", {})),\n servers,\n paths,\n components,\n security,\n tags,\n externalDocs\n };\n}\n"]}
@@ -1,17 +0,0 @@
1
- import { cleanObject } from "@tsed/core";
2
- /**
3
- * @ignore
4
- * @param info
5
- */
6
- export function mapOpenSpecInfo(info) {
7
- const { title, description, version, termsOfService, contact, license } = info;
8
- return cleanObject({
9
- version,
10
- title,
11
- description,
12
- termsOfService,
13
- contact,
14
- license
15
- });
16
- }
17
- //# sourceMappingURL=mapOpenSpecInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapOpenSpecInfo.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpecInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAGvC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAA2B;IACzD,MAAM,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC;IAE7E,OAAO,WAAW,CAAC;QACjB,OAAO;QACP,KAAK;QACL,WAAW;QACX,cAAc;QACd,OAAO;QACP,OAAO;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {OpenSpecInfo} from \"@tsed/openspec\";\n\n/**\n * @ignore\n * @param info\n */\nexport function mapOpenSpecInfo(info: Partial<OpenSpecInfo>): OpenSpecInfo {\n const {title, description, version, termsOfService, contact, license} = info;\n\n return cleanObject({\n version,\n title,\n description,\n termsOfService,\n contact,\n license\n });\n}\n"]}
@@ -1,5 +0,0 @@
1
- export * from "./mapOpenSpec";
2
- export * from "./mapOpenSpec3";
3
- export * from "./mapOpenSpecInfo";
4
- export * from "./mapOpenSpecInfo";
5
- export * from "./matchPath";
@@ -1,10 +0,0 @@
1
- import { OpenSpec3 } from "@tsed/openspec";
2
- /**
3
- * @ignore
4
- * @param spec
5
- * @param fileSpec
6
- * @param version
7
- * @param acceptMimes
8
- * @param specVersion
9
- */
10
- export declare function mapOpenSpec(spec: any, { fileSpec, acceptMimes, specVersion, version }: any): Partial<OpenSpec3>;
@@ -1,8 +0,0 @@
1
- import { OpenSpec3 } from "@tsed/openspec";
2
- /**
3
- * @ignore
4
- * @param spec
5
- * @param version
6
- * @param specVersion
7
- */
8
- export declare function mapOpenSpec3(spec: any, { specVersion }: any): Partial<OpenSpec3>;
@@ -1,6 +0,0 @@
1
- import { OpenSpecInfo } from "@tsed/openspec";
2
- /**
3
- * @ignore
4
- * @param info
5
- */
6
- export declare function mapOpenSpecInfo(info: Partial<OpenSpecInfo>): OpenSpecInfo;