@tsed/openapi-utils 8.5.4 → 8.6.0
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,6 +1,7 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
2
|
import { Env } from "@tsed/core";
|
|
3
3
|
import { constant, inject, injectable } from "@tsed/di";
|
|
4
|
+
import { $asyncAlter } from "@tsed/hooks";
|
|
4
5
|
import { Platform } from "@tsed/platform-http";
|
|
5
6
|
import { generateSpec } from "@tsed/schema";
|
|
6
7
|
import { includeRoute } from "../utils/includeRoute.js";
|
|
@@ -20,13 +21,14 @@ export class OpenAPIService {
|
|
|
20
21
|
.getMountedControllers()
|
|
21
22
|
.filter(({ routes, provider }) => [...routes.values()].some((route) => includeRoute(route, provider, conf)))
|
|
22
23
|
.map(({ route, provider }) => ({ token: provider.token, rootPath: route }));
|
|
23
|
-
|
|
24
|
+
let spec = generateSpec({
|
|
24
25
|
tokens,
|
|
25
26
|
...conf,
|
|
26
27
|
fileSpec: specPath ? await readSpec(specPath) : {},
|
|
27
28
|
version,
|
|
28
29
|
acceptMimes
|
|
29
30
|
});
|
|
31
|
+
spec = await $asyncAlter("$alterOpenSpec", spec, [conf]);
|
|
30
32
|
this.#specs.set(conf.path, spec);
|
|
31
33
|
}
|
|
32
34
|
return this.#specs.get(conf.path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAPIService.js","sourceRoot":"","sources":["../../../src/services/OpenAPIService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAC,GAAG,EAAY,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenAPIService.js","sourceRoot":"","sources":["../../../src/services/OpenAPIService.ts"],"names":[],"mappings":"A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description": "OpenAPI utils to build @tsed/swagger package or @tsed/scalar",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.6.0",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tsed/openspec": "8.
|
|
27
|
+
"@tsed/openspec": "8.6.0",
|
|
28
28
|
"micromatch": "4.0.8",
|
|
29
29
|
"tslib": "2.7.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tsed/barrels": "8.
|
|
33
|
-
"@tsed/core": "8.
|
|
34
|
-
"@tsed/di": "8.
|
|
35
|
-
"@tsed/json-mapper": "8.
|
|
36
|
-
"@tsed/openspec": "8.
|
|
37
|
-
"@tsed/platform-http": "8.
|
|
38
|
-
"@tsed/schema": "8.
|
|
39
|
-
"@tsed/typescript": "8.
|
|
32
|
+
"@tsed/barrels": "8.6.0",
|
|
33
|
+
"@tsed/core": "8.6.0",
|
|
34
|
+
"@tsed/di": "8.6.0",
|
|
35
|
+
"@tsed/json-mapper": "8.6.0",
|
|
36
|
+
"@tsed/openspec": "8.6.0",
|
|
37
|
+
"@tsed/platform-http": "8.6.0",
|
|
38
|
+
"@tsed/schema": "8.6.0",
|
|
39
|
+
"@tsed/typescript": "8.6.0",
|
|
40
40
|
"eslint": "9.12.0",
|
|
41
41
|
"typescript": "5.4.5",
|
|
42
42
|
"vitest": "2.1.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@tsed/platform-http": ">=8.
|
|
45
|
+
"@tsed/platform-http": ">=8.6.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"@tsed/platform-http": {
|
|
@@ -2,6 +2,7 @@ import {writeFile} from "node:fs/promises";
|
|
|
2
2
|
|
|
3
3
|
import {Env, type Type} from "@tsed/core";
|
|
4
4
|
import {constant, inject, injectable} from "@tsed/di";
|
|
5
|
+
import {$asyncAlter} from "@tsed/hooks";
|
|
5
6
|
import {OpenSpec2, OpenSpec3} from "@tsed/openspec";
|
|
6
7
|
import {Platform} from "@tsed/platform-http";
|
|
7
8
|
import {generateSpec} from "@tsed/schema";
|
|
@@ -34,7 +35,7 @@ export class OpenAPIService {
|
|
|
34
35
|
.filter(({routes, provider}) => [...routes.values()].some((route) => includeRoute(route, provider, conf)))
|
|
35
36
|
.map(({route, provider}) => ({token: provider.token as Type, rootPath: route}));
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
let spec = generateSpec({
|
|
38
39
|
tokens,
|
|
39
40
|
...conf,
|
|
40
41
|
fileSpec: specPath ? await readSpec(specPath) : {},
|
|
@@ -42,6 +43,8 @@ export class OpenAPIService {
|
|
|
42
43
|
acceptMimes
|
|
43
44
|
});
|
|
44
45
|
|
|
46
|
+
spec = await $asyncAlter("$alterOpenSpec", spec, [conf]);
|
|
47
|
+
|
|
45
48
|
this.#specs.set(conf.path, spec);
|
|
46
49
|
}
|
|
47
50
|
|