@tsed/swagger 8.0.0-beta.4 → 8.0.0-beta.6

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.
@@ -1,19 +1,18 @@
1
- import { __decorate, __metadata, __param } from "tslib";
2
- import { Configuration, Injectable, InjectorService } from "@tsed/di";
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { constant, Injectable } from "@tsed/di";
3
3
  import { Platform } from "@tsed/platform-http";
4
4
  import { generateSpec } from "@tsed/schema";
5
5
  import { includeRoute } from "../utils/includeRoute.js";
6
6
  let SwaggerService = class SwaggerService {
7
7
  #specs = new Map();
8
- constructor(injectorService, platform, configuration) {
9
- this.injectorService = injectorService;
8
+ constructor(platform) {
10
9
  this.platform = platform;
11
- this.configuration = configuration;
12
10
  }
13
11
  async getOpenAPISpec(conf) {
14
12
  if (!this.#specs.has(conf.path)) {
15
- const { version = "1.0.0", acceptMimes } = this.configuration;
16
- const specPath = conf.specPath ? this.configuration.resolve(conf.specPath) : conf.specPath;
13
+ const version = constant("version", "1.0.0");
14
+ const acceptMimes = constant("acceptMimes");
15
+ const specPath = conf.specPath;
17
16
  const tokens = this.platform
18
17
  .getMountedControllers()
19
18
  .filter(({ routes, provider }) => [...routes.values()].some((route) => includeRoute(route, provider, conf)))
@@ -32,9 +31,7 @@ let SwaggerService = class SwaggerService {
32
31
  };
33
32
  SwaggerService = __decorate([
34
33
  Injectable(),
35
- __param(2, Configuration()),
36
- __metadata("design:paramtypes", [InjectorService,
37
- Platform, Object])
34
+ __metadata("design:paramtypes", [Platform])
38
35
  ], SwaggerService);
39
36
  export { SwaggerService };
40
37
  //# sourceMappingURL=SwaggerService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwaggerService.js","sourceRoot":"","sources":["../../../src/services/SwaggerService.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AAEpE,OAAO,EAAC,Q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AM,CAAC,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;iBACzG,GAAG,CAAC,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,QAAQ,CAAC,KAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC;YAElF,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC;gBAC9B,MAAM;gBACN,GAAG,IAAI;gBACP,QAAQ;gBACR,OAAO;gBACP,WAAW;aACZ,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AApCY,cAAc;IAD1B,UAAU,EAAE;qCAImB,QAAQ;GAH3B,cAAc,CAoC1B"}
@@ -1,13 +1,10 @@
1
- import { Configuration, InjectorService } from "@tsed/di";
2
1
  import { OpenSpec2, OpenSpec3 } from "@tsed/openspec";
3
2
  import { Platform } from "@tsed/platform-http";
4
3
  import { SwaggerOS2Settings, SwaggerOS3Settings, SwaggerSettings } from "../interfaces/SwaggerSettings.js";
5
4
  export declare class SwaggerService {
6
5
  #private;
7
- private injectorService;
8
6
  private platform;
9
- private configuration;
10
- constructor(injectorService: InjectorService, platform: Platform, configuration: Configuration);
7
+ constructor(platform: Platform);
11
8
  /**
12
9
  * Generate Spec for the given configuration
13
10
  * @returns {Spec}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/swagger",
3
3
  "description": "Swagger package for Ts.ED framework",
4
4
  "type": "module",
5
- "version": "8.0.0-beta.4",
5
+ "version": "8.0.0-beta.6",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
@@ -25,23 +25,23 @@
25
25
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
26
26
  },
27
27
  "dependencies": {
28
- "@tsed/normalize-path": "8.0.0-beta.4",
29
- "@tsed/openspec": "8.0.0-beta.4",
28
+ "@tsed/normalize-path": "8.0.0-beta.6",
29
+ "@tsed/openspec": "8.0.0-beta.6",
30
30
  "fs-extra": "11.2.0",
31
31
  "micromatch": "4.0.8",
32
32
  "swagger-ui-dist": ">=5.17.14",
33
33
  "tslib": "2.7.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@tsed/barrels": "8.0.0-beta.4",
37
- "@tsed/core": "8.0.0-beta.4",
38
- "@tsed/di": "8.0.0-beta.4",
39
- "@tsed/json-mapper": "8.0.0-beta.4",
36
+ "@tsed/barrels": "8.0.0-beta.6",
37
+ "@tsed/core": "8.0.0-beta.6",
38
+ "@tsed/di": "8.0.0-beta.6",
39
+ "@tsed/json-mapper": "8.0.0-beta.6",
40
40
  "@tsed/monorepo-utils": "2.3.5",
41
- "@tsed/openspec": "8.0.0-beta.4",
42
- "@tsed/platform-http": "8.0.0-beta.4",
43
- "@tsed/schema": "8.0.0-beta.4",
44
- "@tsed/typescript": "8.0.0-beta.4",
41
+ "@tsed/openspec": "8.0.0-beta.6",
42
+ "@tsed/platform-http": "8.0.0-beta.6",
43
+ "@tsed/schema": "8.0.0-beta.6",
44
+ "@tsed/typescript": "8.0.0-beta.6",
45
45
  "@types/swagger-ui-dist": "3.30.5",
46
46
  "eslint": "9.12.0",
47
47
  "ts-node": "10.9.2",
@@ -49,7 +49,7 @@
49
49
  "vitest": "2.1.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@tsed/platform-http": "8.0.0-beta.4"
52
+ "@tsed/platform-http": "8.0.0-beta.6"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@tsed/common": {
package/readme.md CHANGED
@@ -40,7 +40,7 @@ npm install --save @tsed/swagger
40
40
  Then add the following configuration in your Server:
41
41
 
42
42
  ```typescript
43
- import {Configuration} from "@tsed/common";
43
+ import {Configuration} from "@tsed/di";
44
44
  import "@tsed/swagger"; // import swagger Ts.ED module
45
45
  import {resolve} from "path";
46
46
 
@@ -90,7 +90,7 @@ Some options is available to configure Swagger-ui, Ts.ED and the default spec in
90
90
  It also possible to create several swagger documentations with `doc` option:
91
91
 
92
92
  ```typescript
93
- import {Configuration} from "@tsed/common";
93
+ import {Configuration} from "@tsed/di";
94
94
  import "@tsed/swagger"; // import swagger Ts.ED module
95
95
 
96
96
  @Configuration({
@@ -111,7 +111,7 @@ export class Server {}
111
111
  Then use `@Docs` decorators on your controllers to specify where the controllers should be displayed.
112
112
 
113
113
  ```typescript
114
- import {Controller} from "@tsed/common";
114
+ import {Controller} from "@tsed/di";
115
115
  import {Docs} from "@tsed/swagger";
116
116
 
117
117
  @Controller("/calendars")
@@ -133,7 +133,7 @@ JSON Object (see [converters section](https://tsed.io/docs/components/converters
133
133
  This model can used on a method controller along with [@BodyParams](https://tsed.io/api/common/filters/decorators/BodyParams.html) or other decorators.
134
134
 
135
135
  ```typescript
136
- import {JsonProperty, Title, Description, Example} from "@tsed/common";
136
+ import {JsonProperty, Title, Description, Example} from "@tsed/schema";
137
137
 
138
138
  export class CalendarModel {
139
139
  @Title("iD")
@@ -150,8 +150,9 @@ export class CalendarModel {
150
150
  #### Endpoint documentation
151
151
 
152
152
  ```typescript
153
- import {BodyParams, Controller, Get, Post, QueryParams, Returns, ReturnsArray, Description} from "@tsed/common";
154
- import {Summary, Deprecated, Security} from "@tsed/swagger";
153
+ import {Controller} from "@tsed/di";
154
+ import {BodyParams, QueryParams} from "@tsed/platform-params";
155
+ import {Get, Post, Returns, ReturnsArray, Description, Summary, Deprecated, Security} from "@tsed/schema";
155
156
  import {CalendarModel} from "../models/CalendarModel.js";
156
157
 
157
158
  @Controller("/calendars")
@@ -199,7 +200,7 @@ To update the swagger.json you need to reload the server before.
199
200
  It possible to import a Javascript in the Swagger-ui documentation. This script let you customize the swagger-ui instance.
200
201
 
201
202
  ```typescript
202
- import {Configuration} from "@tsed/common";
203
+ import {Configuration} from "@tsed/di";
203
204
  import "@tsed/swagger"; // import swagger Ts.ED module
204
205
 
205
206
  @Configuration({