@tsed/swagger 6.105.2 → 6.106.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.
- package/jest.config.js +14 -0
- package/lib/cjs/SwaggerModule.js +4 -4
- package/lib/cjs/SwaggerModule.js.map +1 -1
- package/lib/cjs/index.js +12 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/SwaggerSettings.js.map +1 -1
- package/lib/cjs/interfaces/interfaces.js +3 -0
- package/lib/cjs/interfaces/interfaces.js.map +1 -0
- package/lib/cjs/services/SwaggerService.js +14 -73
- package/lib/cjs/services/SwaggerService.js.map +1 -1
- package/lib/cjs/utils/includeRoute.js +2 -2
- package/lib/cjs/utils/includeRoute.js.map +1 -1
- package/lib/esm/SwaggerModule.js +4 -4
- package/lib/esm/SwaggerModule.js.map +1 -1
- package/lib/esm/index.js +12 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/SwaggerSettings.js.map +1 -1
- package/lib/esm/interfaces/interfaces.js +2 -0
- package/lib/esm/interfaces/interfaces.js.map +1 -0
- package/lib/esm/services/SwaggerService.js +15 -74
- package/lib/esm/services/SwaggerService.js.map +1 -1
- package/lib/esm/utils/includeRoute.js +1 -1
- package/lib/esm/utils/includeRoute.js.map +1 -1
- package/lib/types/SwaggerModule.d.ts +1 -1
- package/lib/types/index.d.ts +12 -2
- package/lib/types/interfaces/SwaggerSettings.d.ts +0 -3
- package/lib/types/interfaces/{index.d.ts → interfaces.d.ts} +0 -1
- package/lib/types/services/SwaggerService.d.ts +4 -22
- package/lib/types/utils/includeRoute.d.ts +1 -1
- package/package.json +18 -15
- package/lib/cjs/interfaces/index.js +0 -5
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/utils/getSpecType.js +0 -21
- package/lib/cjs/utils/getSpecType.js.map +0 -1
- package/lib/cjs/utils/index.js +0 -11
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/mapOpenSpec.js +0 -40
- package/lib/cjs/utils/mapOpenSpec.js.map +0 -1
- package/lib/cjs/utils/mapOpenSpec2.js +0 -35
- package/lib/cjs/utils/mapOpenSpec2.js.map +0 -1
- package/lib/cjs/utils/mapOpenSpec3.js +0 -26
- package/lib/cjs/utils/mapOpenSpec3.js.map +0 -1
- package/lib/cjs/utils/mapOpenSpecInfo.js +0 -21
- package/lib/cjs/utils/mapOpenSpecInfo.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -2
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/esm/utils/getSpecType.js +0 -16
- package/lib/esm/utils/getSpecType.js.map +0 -1
- package/lib/esm/utils/index.js +0 -8
- package/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/mapOpenSpec.js +0 -36
- package/lib/esm/utils/mapOpenSpec.js.map +0 -1
- package/lib/esm/utils/mapOpenSpec2.js +0 -31
- package/lib/esm/utils/mapOpenSpec2.js.map +0 -1
- package/lib/esm/utils/mapOpenSpec3.js +0 -22
- package/lib/esm/utils/mapOpenSpec3.js.map +0 -1
- package/lib/esm/utils/mapOpenSpecInfo.js +0 -17
- package/lib/esm/utils/mapOpenSpecInfo.js.map +0 -1
- package/lib/types/utils/getSpecType.d.ts +0 -12
- package/lib/types/utils/index.d.ts +0 -7
- package/lib/types/utils/mapOpenSpec.d.ts +0 -10
- package/lib/types/utils/mapOpenSpec2.d.ts +0 -10
- package/lib/types/utils/mapOpenSpec3.d.ts +0 -8
- package/lib/types/utils/mapOpenSpecInfo.d.ts +0 -6
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
2
4
|
export * from "./SwaggerModule";
|
|
3
|
-
export * from "./interfaces";
|
|
4
5
|
export * from "./decorators/docs";
|
|
5
6
|
export * from "./decorators/hidden";
|
|
7
|
+
export * from "./interfaces/SwaggerSettings";
|
|
8
|
+
export * from "./interfaces/interfaces";
|
|
9
|
+
export * from "./middlewares/cssMiddleware";
|
|
10
|
+
export * from "./middlewares/indexMiddleware";
|
|
11
|
+
export * from "./middlewares/jsMiddleware";
|
|
12
|
+
export * from "./middlewares/redirectMiddleware";
|
|
13
|
+
export * from "./services/SwaggerService";
|
|
14
|
+
export * from "./utils/includeRoute";
|
|
15
|
+
export * from "./utils/matchPath";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Configuration,
|
|
1
|
+
import { Configuration, InjectorService, Platform } from "@tsed/common";
|
|
2
2
|
import { OpenSpec2, OpenSpec3 } from "@tsed/openspec";
|
|
3
|
-
import { SpecSerializerOptions } from "@tsed/schema";
|
|
4
3
|
import { SwaggerOS2Settings, SwaggerOS3Settings, SwaggerSettings } from "../interfaces/SwaggerSettings";
|
|
5
4
|
export declare class SwaggerService {
|
|
6
5
|
#private;
|
|
@@ -12,24 +11,7 @@ export declare class SwaggerService {
|
|
|
12
11
|
* Generate Spec for the given configuration
|
|
13
12
|
* @returns {Spec}
|
|
14
13
|
*/
|
|
15
|
-
getOpenAPISpec(conf: SwaggerOS3Settings): OpenSpec3
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
getOpenAPISpec(conf: SwaggerOS2Settings): OpenSpec2;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated
|
|
22
|
-
*/
|
|
23
|
-
getOpenAPISpec(conf: SwaggerSettings): OpenSpec2;
|
|
24
|
-
/**
|
|
25
|
-
* Return the global api information.
|
|
26
|
-
*/
|
|
27
|
-
protected getDefaultSpec(conf: Partial<SwaggerSettings>): Partial<OpenSpec2 | OpenSpec3>;
|
|
28
|
-
protected readSpecPath(path: string): any;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param ctrl
|
|
32
|
-
* @param options
|
|
33
|
-
*/
|
|
34
|
-
protected buildRoutes(ctrl: ControllerProvider, options: SpecSerializerOptions): Partial<OpenSpec2>;
|
|
14
|
+
getOpenAPISpec(conf: SwaggerOS3Settings): Promise<OpenSpec3>;
|
|
15
|
+
getOpenAPISpec(conf: SwaggerOS2Settings): Promise<OpenSpec2>;
|
|
16
|
+
getOpenAPISpec(conf: SwaggerSettings): Promise<OpenSpec2>;
|
|
35
17
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControllerProvider } from "@tsed/common";
|
|
2
|
-
import { SwaggerSettings } from "
|
|
2
|
+
import { SwaggerSettings } from "../interfaces/SwaggerSettings";
|
|
3
3
|
export declare function includeRoute(route: string, provider: ControllerProvider, conf: SwaggerSettings): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/swagger",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.106.0",
|
|
4
4
|
"description": "Swagger package for Ts.ED framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -14,32 +14,35 @@
|
|
|
14
14
|
"default": "./lib/esm/index.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"
|
|
17
|
+
"clean": "rm -rf lib",
|
|
18
|
+
"build": "yarn clean && yarn barrels && yarn run build:esm && yarn run build:cjs && cp -r ./views ./lib/views",
|
|
18
19
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
19
20
|
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
-
"
|
|
21
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
22
|
+
"start": "ts-node -r tsconfig-paths/register test/app/index.ts",
|
|
23
|
+
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@tsed/openspec": "6.
|
|
24
|
-
"fs-extra": "
|
|
26
|
+
"@tsed/openspec": "6.106.0",
|
|
27
|
+
"fs-extra": "10.0.1",
|
|
25
28
|
"micromatch": "4.0.4",
|
|
26
29
|
"swagger-ui-dist": "^4.5.2",
|
|
27
30
|
"tslib": "2.2.0"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@tsed/common": "6.
|
|
31
|
-
"@tsed/core": "6.
|
|
32
|
-
"@tsed/di": "6.
|
|
33
|
-
"@tsed/json-mapper": "6.
|
|
34
|
-
"@tsed/openspec": "6.
|
|
35
|
-
"@tsed/schema": "6.
|
|
33
|
+
"@tsed/common": "6.106.0",
|
|
34
|
+
"@tsed/core": "6.106.0",
|
|
35
|
+
"@tsed/di": "6.106.0",
|
|
36
|
+
"@tsed/json-mapper": "6.106.0",
|
|
37
|
+
"@tsed/openspec": "6.106.0",
|
|
38
|
+
"@tsed/schema": "6.106.0",
|
|
36
39
|
"@types/swagger-ui-dist": ">=3.30.1"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
39
|
-
"@tsed/common": "^6.
|
|
40
|
-
"@tsed/core": "^6.
|
|
41
|
-
"@tsed/json-mapper": "^6.
|
|
42
|
-
"@tsed/schema": "^6.
|
|
42
|
+
"@tsed/common": "^6.106.0",
|
|
43
|
+
"@tsed/core": "^6.106.0",
|
|
44
|
+
"@tsed/json-mapper": "^6.106.0",
|
|
45
|
+
"@tsed/schema": "^6.106.0"
|
|
43
46
|
},
|
|
44
47
|
"repository": "https://github.com/tsedio/tsed",
|
|
45
48
|
"bugs": {
|
|
@@ -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,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSpecTypeFromSpec = exports.getSpecType = void 0;
|
|
4
|
-
const schema_1 = require("@tsed/schema");
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
* @param version
|
|
8
|
-
*/
|
|
9
|
-
function getSpecType(version) {
|
|
10
|
-
return version.startsWith("3.") ? schema_1.SpecTypes.OPENAPI : schema_1.SpecTypes.SWAGGER;
|
|
11
|
-
}
|
|
12
|
-
exports.getSpecType = getSpecType;
|
|
13
|
-
/**
|
|
14
|
-
* @ignore
|
|
15
|
-
* @param spec
|
|
16
|
-
*/
|
|
17
|
-
function getSpecTypeFromSpec(spec) {
|
|
18
|
-
return "openapi" in spec ? schema_1.SpecTypes.OPENAPI : schema_1.SpecTypes.SWAGGER;
|
|
19
|
-
}
|
|
20
|
-
exports.getSpecTypeFromSpec = getSpecTypeFromSpec;
|
|
21
|
-
//# sourceMappingURL=getSpecType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSpecType.js","sourceRoot":"","sources":["../../../src/utils/getSpecType.ts"],"names":[],"mappings":";;;AACA,yCAAuC;AAEvC;;;GAGG;AACH,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAS,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAS,CAAC,OAAO,CAAC;AAC1E,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAoC;IACtE,OAAO,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,kBAAS,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAS,CAAC,OAAO,CAAC;AACnE,CAAC;AAFD,kDAEC","sourcesContent":["import {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {SpecTypes} from \"@tsed/schema\";\n\n/**\n * @ignore\n * @param version\n */\nexport function getSpecType(version: string) {\n return version.startsWith(\"3.\") ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;\n}\n\n/**\n * @ignore\n * @param spec\n */\nexport function getSpecTypeFromSpec(spec: Partial<OpenSpec2 | OpenSpec3>) {\n return \"openapi\" in spec ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;\n}\n"]}
|
package/lib/cjs/utils/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./getSpecType"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./mapOpenSpec"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./mapOpenSpec2"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./mapOpenSpec3"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./mapOpenSpecInfo"), exports);
|
|
9
|
-
(0, tslib_1.__exportStar)(require("./mapOpenSpecInfo"), exports);
|
|
10
|
-
(0, tslib_1.__exportStar)(require("./matchPath"), exports);
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAC9B,6DAA8B;AAC9B,8DAA+B;AAC/B,8DAA+B;AAC/B,iEAAkC;AAClC,iEAAkC;AAClC,2DAA4B","sourcesContent":["export * from \"./getSpecType\";\nexport * from \"./mapOpenSpec\";\nexport * from \"./mapOpenSpec2\";\nexport * from \"./mapOpenSpec3\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./matchPath\";\n"]}
|
|
@@ -1,40 +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 getSpecType_1 = require("./getSpecType");
|
|
7
|
-
const mapOpenSpec2_1 = require("./mapOpenSpec2");
|
|
8
|
-
const mapOpenSpec3_1 = require("./mapOpenSpec3");
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
* @param spec
|
|
12
|
-
* @param fileSpec
|
|
13
|
-
* @param version
|
|
14
|
-
* @param acceptMimes
|
|
15
|
-
* @param specVersion
|
|
16
|
-
*/
|
|
17
|
-
function mapOpenSpec(spec, { fileSpec, acceptMimes, specVersion, version }) {
|
|
18
|
-
specVersion = specVersion || (0, core_1.getValue)(spec, "openapi", (0, core_1.getValue)(spec, "swagger", "2.0"));
|
|
19
|
-
const options = {
|
|
20
|
-
specVersion,
|
|
21
|
-
acceptMimes
|
|
22
|
-
};
|
|
23
|
-
switch ((0, getSpecType_1.getSpecType)(specVersion)) {
|
|
24
|
-
case schema_1.SpecTypes.OPENAPI:
|
|
25
|
-
spec = (0, mapOpenSpec3_1.mapOpenSpec3)(spec, options);
|
|
26
|
-
fileSpec = fileSpec ? (0, mapOpenSpec3_1.mapOpenSpec3)(fileSpec, options) : fileSpec;
|
|
27
|
-
break;
|
|
28
|
-
default:
|
|
29
|
-
case schema_1.SpecTypes.SWAGGER:
|
|
30
|
-
spec = (0, mapOpenSpec2_1.mapOpenSpec2)(spec, options);
|
|
31
|
-
fileSpec = fileSpec ? (0, mapOpenSpec2_1.mapOpenSpec2)(fileSpec, options) : fileSpec;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
spec = (0, schema_1.mergeSpec)(spec, fileSpec);
|
|
35
|
-
(0, core_1.setValue)(spec, "info.title", (0, core_1.getValue)(spec, "info.title", "Api documentation"));
|
|
36
|
-
(0, core_1.setValue)(spec, "info.version", (0, core_1.getValue)(spec, "info.version", version));
|
|
37
|
-
return spec;
|
|
38
|
-
}
|
|
39
|
-
exports.mapOpenSpec = mapOpenSpec;
|
|
40
|
-
//# sourceMappingURL=mapOpenSpec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapOpenSpec.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAE9C,yCAAkD;AAClD,+CAA0C;AAC1C,iDAA4C;AAC5C,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,IAAA,eAAQ,EAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3G,MAAM,OAAO,GAAG;QACd,WAAW;QACX,WAAW;KACZ,CAAC;IAEF,QAAQ,IAAA,yBAAW,EAAC,WAAW,CAAC,EAAE;QAChC,KAAK,kBAAS,CAAC,OAAO;YACpB,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,2BAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,MAAM;QACR,QAAQ;QACR,KAAK,kBAAS,CAAC,OAAO;YACpB,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,2BAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,MAAM;KACT;IAED,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;AA1BD,kCA0BC","sourcesContent":["import {getValue, setValue} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3, OpenSpecVersions} from \"@tsed/openspec\";\nimport {mergeSpec, SpecTypes} from \"@tsed/schema\";\nimport {getSpecType} from \"./getSpecType\";\nimport {mapOpenSpec2} from \"./mapOpenSpec2\";\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<OpenSpec2 | OpenSpec3> {\n specVersion = specVersion || getValue<OpenSpecVersions>(spec, \"openapi\", getValue(spec, \"swagger\", \"2.0\"));\n\n const options = {\n specVersion,\n acceptMimes\n };\n\n switch (getSpecType(specVersion)) {\n case SpecTypes.OPENAPI:\n spec = mapOpenSpec3(spec, options);\n fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;\n break;\n default:\n case SpecTypes.SWAGGER:\n spec = mapOpenSpec2(spec, options);\n fileSpec = fileSpec ? mapOpenSpec2(fileSpec, options) : fileSpec;\n break;\n }\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,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapOpenSpec2 = 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
|
-
* @param acceptMimes
|
|
12
|
-
* @deprecated
|
|
13
|
-
*/
|
|
14
|
-
function mapOpenSpec2(spec, { version, specVersion, acceptMimes = ["application/json"] }) {
|
|
15
|
-
const { paths, security, tags, host, basePath, schemes, consumes = [], produces = ["application/json"], definitions, parameters, responses, securityDefinitions, externalDocs } = spec;
|
|
16
|
-
return {
|
|
17
|
-
swagger: specVersion,
|
|
18
|
-
consumes: (0, core_1.uniq)([...acceptMimes, ...consumes]),
|
|
19
|
-
produces: (0, core_1.uniq)([...produces]),
|
|
20
|
-
info: (0, mapOpenSpecInfo_1.mapOpenSpecInfo)((0, core_1.getValue)(spec, "info", {})),
|
|
21
|
-
paths,
|
|
22
|
-
host,
|
|
23
|
-
basePath,
|
|
24
|
-
schemes,
|
|
25
|
-
definitions,
|
|
26
|
-
parameters,
|
|
27
|
-
responses,
|
|
28
|
-
security,
|
|
29
|
-
securityDefinitions,
|
|
30
|
-
tags,
|
|
31
|
-
externalDocs
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
exports.mapOpenSpec2 = mapOpenSpec2;
|
|
35
|
-
//# sourceMappingURL=mapOpenSpec2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapOpenSpec2.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec2.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAE1C,uDAAkD;AAElD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,IAAwB,EACxB,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,kBAAkB,CAAC,EAAM;IAE/D,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,CAAC,kBAAkB,CAAC,EAC/B,WAAW,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,YAAY,EACb,GAAG,IAAI,CAAC;IAET,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,IAAA,WAAI,EAAC,CAAC,GAAG,WAAW,EAAE,GAAG,QAAQ,CAAC,CAAC;QAC7C,QAAQ,EAAE,IAAA,WAAI,EAAS,CAAC,GAAG,QAAQ,CAAC,CAAC;QACrC,IAAI,EAAE,IAAA,iCAAe,EAAC,IAAA,eAAQ,EAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACjD,KAAK;QACL,IAAI;QACJ,QAAQ;QACR,OAAO;QACP,WAAW;QACX,UAAU;QACV,SAAS;QACT,QAAQ;QACR,mBAAmB;QACnB,IAAI;QACJ,YAAY;KACb,CAAC;AACJ,CAAC;AArCD,oCAqCC","sourcesContent":["import {getValue, uniq} from \"@tsed/core\";\nimport {OpenSpec2} from \"@tsed/openspec\";\nimport {mapOpenSpecInfo} from \"./mapOpenSpecInfo\";\n\n/**\n * @ignore\n * @param spec\n * @param version\n * @param specVersion\n * @param acceptMimes\n * @deprecated\n */\nexport function mapOpenSpec2(\n spec: Partial<OpenSpec2>,\n {version, specVersion, acceptMimes = [\"application/json\"]}: any\n): Partial<OpenSpec2> {\n const {\n paths,\n security,\n tags,\n host,\n basePath,\n schemes,\n consumes = [],\n produces = [\"application/json\"],\n definitions,\n parameters,\n responses,\n securityDefinitions,\n externalDocs\n } = spec;\n\n return {\n swagger: specVersion,\n consumes: uniq([...acceptMimes, ...consumes]),\n produces: uniq<string>([...produces]),\n info: mapOpenSpecInfo(getValue(spec, \"info\", {})),\n paths,\n host,\n basePath,\n schemes,\n definitions,\n parameters,\n responses,\n security,\n securityDefinitions,\n tags,\n externalDocs\n };\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 +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,16 +0,0 @@
|
|
|
1
|
-
import { SpecTypes } from "@tsed/schema";
|
|
2
|
-
/**
|
|
3
|
-
* @ignore
|
|
4
|
-
* @param version
|
|
5
|
-
*/
|
|
6
|
-
export function getSpecType(version) {
|
|
7
|
-
return version.startsWith("3.") ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
* @param spec
|
|
12
|
-
*/
|
|
13
|
-
export function getSpecTypeFromSpec(spec) {
|
|
14
|
-
return "openapi" in spec ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=getSpecType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSpecType.js","sourceRoot":"","sources":["../../../src/utils/getSpecType.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAoC;IACtE,OAAO,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;AACnE,CAAC","sourcesContent":["import {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {SpecTypes} from \"@tsed/schema\";\n\n/**\n * @ignore\n * @param version\n */\nexport function getSpecType(version: string) {\n return version.startsWith(\"3.\") ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;\n}\n\n/**\n * @ignore\n * @param spec\n */\nexport function getSpecTypeFromSpec(spec: Partial<OpenSpec2 | OpenSpec3>) {\n return \"openapi\" in spec ? SpecTypes.OPENAPI : SpecTypes.SWAGGER;\n}\n"]}
|
package/lib/esm/utils/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./getSpecType.js";
|
|
2
|
-
export * from "./mapOpenSpec.js";
|
|
3
|
-
export * from "./mapOpenSpec2.js";
|
|
4
|
-
export * from "./mapOpenSpec3.js";
|
|
5
|
-
export * from "./mapOpenSpecInfo.js";
|
|
6
|
-
export * from "./mapOpenSpecInfo.js";
|
|
7
|
-
export * from "./matchPath.js";
|
|
8
|
-
//# 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,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./getSpecType\";\nexport * from \"./mapOpenSpec\";\nexport * from \"./mapOpenSpec2\";\nexport * from \"./mapOpenSpec3\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./mapOpenSpecInfo\";\nexport * from \"./matchPath\";\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getValue, setValue } from "@tsed/core";
|
|
2
|
-
import { mergeSpec, SpecTypes } from "@tsed/schema";
|
|
3
|
-
import { getSpecType } from "./getSpecType.js";
|
|
4
|
-
import { mapOpenSpec2 } from "./mapOpenSpec2.js";
|
|
5
|
-
import { mapOpenSpec3 } from "./mapOpenSpec3.js";
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
* @param spec
|
|
9
|
-
* @param fileSpec
|
|
10
|
-
* @param version
|
|
11
|
-
* @param acceptMimes
|
|
12
|
-
* @param specVersion
|
|
13
|
-
*/
|
|
14
|
-
export function mapOpenSpec(spec, { fileSpec, acceptMimes, specVersion, version }) {
|
|
15
|
-
specVersion = specVersion || getValue(spec, "openapi", getValue(spec, "swagger", "2.0"));
|
|
16
|
-
const options = {
|
|
17
|
-
specVersion,
|
|
18
|
-
acceptMimes
|
|
19
|
-
};
|
|
20
|
-
switch (getSpecType(specVersion)) {
|
|
21
|
-
case SpecTypes.OPENAPI:
|
|
22
|
-
spec = mapOpenSpec3(spec, options);
|
|
23
|
-
fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;
|
|
24
|
-
break;
|
|
25
|
-
default:
|
|
26
|
-
case SpecTypes.SWAGGER:
|
|
27
|
-
spec = mapOpenSpec2(spec, options);
|
|
28
|
-
fileSpec = fileSpec ? mapOpenSpec2(fileSpec, options) : fileSpec;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
spec = mergeSpec(spec, fileSpec);
|
|
32
|
-
setValue(spec, "info.title", getValue(spec, "info.title", "Api documentation"));
|
|
33
|
-
setValue(spec, "info.version", getValue(spec, "info.version", version));
|
|
34
|
-
return spec;
|
|
35
|
-
}
|
|
36
|
-
//# 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,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,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,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3G,MAAM,OAAO,GAAG;QACd,WAAW;QACX,WAAW;KACZ,CAAC;IAEF,QAAQ,WAAW,CAAC,WAAW,CAAC,EAAE;QAChC,KAAK,SAAS,CAAC,OAAO;YACpB,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,MAAM;QACR,QAAQ;QACR,KAAK,SAAS,CAAC,OAAO;YACpB,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,MAAM;KACT;IAED,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 {OpenSpec2, OpenSpec3, OpenSpecVersions} from \"@tsed/openspec\";\nimport {mergeSpec, SpecTypes} from \"@tsed/schema\";\nimport {getSpecType} from \"./getSpecType\";\nimport {mapOpenSpec2} from \"./mapOpenSpec2\";\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<OpenSpec2 | OpenSpec3> {\n specVersion = specVersion || getValue<OpenSpecVersions>(spec, \"openapi\", getValue(spec, \"swagger\", \"2.0\"));\n\n const options = {\n specVersion,\n acceptMimes\n };\n\n switch (getSpecType(specVersion)) {\n case SpecTypes.OPENAPI:\n spec = mapOpenSpec3(spec, options);\n fileSpec = fileSpec ? mapOpenSpec3(fileSpec, options) : fileSpec;\n break;\n default:\n case SpecTypes.SWAGGER:\n spec = mapOpenSpec2(spec, options);\n fileSpec = fileSpec ? mapOpenSpec2(fileSpec, options) : fileSpec;\n break;\n }\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,31 +0,0 @@
|
|
|
1
|
-
import { getValue, uniq } from "@tsed/core";
|
|
2
|
-
import { mapOpenSpecInfo } from "./mapOpenSpecInfo.js";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
* @param spec
|
|
6
|
-
* @param version
|
|
7
|
-
* @param specVersion
|
|
8
|
-
* @param acceptMimes
|
|
9
|
-
* @deprecated
|
|
10
|
-
*/
|
|
11
|
-
export function mapOpenSpec2(spec, { version, specVersion, acceptMimes = ["application/json"] }) {
|
|
12
|
-
const { paths, security, tags, host, basePath, schemes, consumes = [], produces = ["application/json"], definitions, parameters, responses, securityDefinitions, externalDocs } = spec;
|
|
13
|
-
return {
|
|
14
|
-
swagger: specVersion,
|
|
15
|
-
consumes: uniq([...acceptMimes, ...consumes]),
|
|
16
|
-
produces: uniq([...produces]),
|
|
17
|
-
info: mapOpenSpecInfo(getValue(spec, "info", {})),
|
|
18
|
-
paths,
|
|
19
|
-
host,
|
|
20
|
-
basePath,
|
|
21
|
-
schemes,
|
|
22
|
-
definitions,
|
|
23
|
-
parameters,
|
|
24
|
-
responses,
|
|
25
|
-
security,
|
|
26
|
-
securityDefinitions,
|
|
27
|
-
tags,
|
|
28
|
-
externalDocs
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=mapOpenSpec2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapOpenSpec2.js","sourceRoot":"","sources":["../../../src/utils/mapOpenSpec2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAwB,EACxB,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,kBAAkB,CAAC,EAAM;IAE/D,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,CAAC,kBAAkB,CAAC,EAC/B,WAAW,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,YAAY,EACb,GAAG,IAAI,CAAC;IAET,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,IAAI,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,QAAQ,CAAC,CAAC;QAC7C,QAAQ,EAAE,IAAI,CAAS,CAAC,GAAG,QAAQ,CAAC,CAAC;QACrC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACjD,KAAK;QACL,IAAI;QACJ,QAAQ;QACR,OAAO;QACP,WAAW;QACX,UAAU;QACV,SAAS;QACT,QAAQ;QACR,mBAAmB;QACnB,IAAI;QACJ,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import {getValue, uniq} from \"@tsed/core\";\nimport {OpenSpec2} from \"@tsed/openspec\";\nimport {mapOpenSpecInfo} from \"./mapOpenSpecInfo\";\n\n/**\n * @ignore\n * @param spec\n * @param version\n * @param specVersion\n * @param acceptMimes\n * @deprecated\n */\nexport function mapOpenSpec2(\n spec: Partial<OpenSpec2>,\n {version, specVersion, acceptMimes = [\"application/json\"]}: any\n): Partial<OpenSpec2> {\n const {\n paths,\n security,\n tags,\n host,\n basePath,\n schemes,\n consumes = [],\n produces = [\"application/json\"],\n definitions,\n parameters,\n responses,\n securityDefinitions,\n externalDocs\n } = spec;\n\n return {\n swagger: specVersion,\n consumes: uniq([...acceptMimes, ...consumes]),\n produces: uniq<string>([...produces]),\n info: mapOpenSpecInfo(getValue(spec, \"info\", {})),\n paths,\n host,\n basePath,\n schemes,\n definitions,\n parameters,\n responses,\n security,\n securityDefinitions,\n tags,\n externalDocs\n };\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getValue } from "@tsed/core";
|
|
2
|
-
import { mapOpenSpecInfo } from "./mapOpenSpecInfo.js";
|
|
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,12 +0,0 @@
|
|
|
1
|
-
import { OpenSpec2, OpenSpec3 } from "@tsed/openspec";
|
|
2
|
-
import { SpecTypes } from "@tsed/schema";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
* @param version
|
|
6
|
-
*/
|
|
7
|
-
export declare function getSpecType(version: string): SpecTypes.SWAGGER | SpecTypes.OPENAPI;
|
|
8
|
-
/**
|
|
9
|
-
* @ignore
|
|
10
|
-
* @param spec
|
|
11
|
-
*/
|
|
12
|
-
export declare function getSpecTypeFromSpec(spec: Partial<OpenSpec2 | OpenSpec3>): SpecTypes.SWAGGER | SpecTypes.OPENAPI;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OpenSpec2, 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<OpenSpec2 | OpenSpec3>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OpenSpec2 } from "@tsed/openspec";
|
|
2
|
-
/**
|
|
3
|
-
* @ignore
|
|
4
|
-
* @param spec
|
|
5
|
-
* @param version
|
|
6
|
-
* @param specVersion
|
|
7
|
-
* @param acceptMimes
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
export declare function mapOpenSpec2(spec: Partial<OpenSpec2>, { version, specVersion, acceptMimes }: any): Partial<OpenSpec2>;
|