@nestia/migrate 0.9.7 → 0.11.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/lib/MigrateApplication.d.ts +3 -1
- package/lib/MigrateApplication.js +1558 -1507
- package/lib/MigrateApplication.js.map +1 -1
- package/lib/analyzers/MigrateMethodAnalyzer.js +31 -18
- package/lib/analyzers/MigrateMethodAnalyzer.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +1 -1
- package/lib/internal/MigrateCommander.js +1 -1
- package/lib/internal/MigrateCommander.js.map +1 -1
- package/lib/programmers/MigrateSchemaProgrammer.js +1 -1
- package/lib/programmers/MigrateSchemaProgrammer.js.map +1 -1
- package/lib/structures/ISwaggerComponents.d.ts +5 -1
- package/lib/structures/ISwaggerRoute.d.ts +4 -33
- package/lib/structures/ISwaggerRouteBodyContent.d.ts +14 -0
- package/lib/structures/ISwaggerRouteBodyContent.js +3 -0
- package/lib/structures/ISwaggerRouteBodyContent.js.map +1 -0
- package/lib/structures/ISwaggerRouteHeader.js +2 -0
- package/lib/structures/ISwaggerRouteHeader.js.map +1 -0
- package/lib/structures/ISwaggerRouteRequestBody.d.ts +11 -0
- package/lib/structures/ISwaggerRouteRequestBody.js +3 -0
- package/lib/structures/ISwaggerRouteRequestBody.js.map +1 -0
- package/lib/structures/ISwaggerRouteResponse.d.ts +10 -0
- package/lib/structures/ISwaggerRouteResponse.js +3 -0
- package/lib/structures/ISwaggerRouteResponse.js.map +1 -0
- package/lib/structures/ISwaggerV20.d.ts +8 -0
- package/lib/structures/ISwaggerV20.js +3 -0
- package/lib/structures/ISwaggerV20.js.map +1 -0
- package/lib/structures/ISwaggerV31.d.ts +9 -0
- package/lib/structures/ISwaggerV31.js +3 -0
- package/lib/structures/ISwaggerV31.js.map +1 -0
- package/lib/utils/OpenApiConverter.d.ts +7 -0
- package/lib/utils/OpenApiConverter.js +3132 -0
- package/lib/utils/OpenApiConverter.js.map +1 -0
- package/lib/utils/SwaggerComponentsExplorer.d.ts +9 -0
- package/lib/utils/SwaggerComponentsExplorer.js +29 -0
- package/lib/utils/SwaggerComponentsExplorer.js.map +1 -0
- package/lib/utils/SwaggerTypeChecker.d.ts +0 -2
- package/lib/utils/SwaggerTypeChecker.js +0 -6
- package/lib/utils/SwaggerTypeChecker.js.map +1 -1
- package/package.json +78 -74
- package/src/MigrateApplication.ts +17 -8
- package/src/analyzers/MigrateMethodAnalyzer.ts +59 -19
- package/src/bundles/NEST_TEMPLATE.ts +1 -1
- package/src/internal/MigrateCommander.ts +1 -1
- package/src/programmers/MigrateSchemaProgrammer.ts +4 -1
- package/src/structures/ISwagger.ts +23 -23
- package/src/structures/ISwaggerComponents.ts +5 -1
- package/src/structures/ISwaggerRoute.ts +7 -36
- package/src/structures/ISwaggerRouteBodyContent.ts +15 -0
- package/src/structures/ISwaggerRouteHeader.ts +0 -0
- package/src/structures/ISwaggerRouteRequestBody.ts +12 -0
- package/src/structures/ISwaggerRouteResponse.ts +11 -0
- package/src/structures/ISwaggerV20.ts +10 -0
- package/src/structures/ISwaggerV31.ts +10 -0
- package/src/utils/OpenApiConverter.ts +20 -0
- package/src/utils/SwaggerComponentsExplorer.ts +43 -0
- package/src/utils/SwaggerTypeChecker.ts +0 -12
- /package/{src/structures/ISwaggerRouteHeaders.ts → lib/structures/ISwaggerRouteHeader.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenApiConverter.js","sourceRoot":"","sources":["../../src/utils/OpenApiConverter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAA4C;AAC5C,kDAA0B;AAE1B,wEAA2E;AAM3E,IAAiB,gBAAgB,CAUhC;AAVD,WAAiB,gBAAgB;IAClB,qBAAI,GAAG,CAAO,OAAoB,EAAqB,EAAE;QACpE,MAAM,MAAM,GAAG,MAAM,yBAAa,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3D;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAW,SAAS,CAAC,OAAO,EAAc,EAAE;IACjE,CAAC,CAAC;AACJ,CAAC,EAVgB,gBAAgB,gCAAhB,gBAAgB,QAUhC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ISwaggerComponents } from "../module";
|
|
2
|
+
import { ISwaggerRouteParameter } from "../structures/ISwaggerRouteParameter";
|
|
3
|
+
import { ISwaggerRouteRequestBody } from "../structures/ISwaggerRouteRequestBody";
|
|
4
|
+
import { ISwaggerRouteResponse } from "../structures/ISwaggerRouteResponse";
|
|
5
|
+
export declare namespace SwaggerComponentsExplorer {
|
|
6
|
+
const getParameter: (components: ISwaggerComponents) => (schema: ISwaggerRouteParameter | ISwaggerRouteParameter.IReference) => ISwaggerRouteParameter | null;
|
|
7
|
+
const getRequestBody: (components: ISwaggerComponents) => (schema: ISwaggerRouteRequestBody | ISwaggerRouteRequestBody.IReference) => ISwaggerRouteRequestBody | null;
|
|
8
|
+
const getResponse: (components: ISwaggerComponents) => (schema: ISwaggerRouteResponse | ISwaggerRouteResponse.IReference) => ISwaggerRouteResponse | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwaggerComponentsExplorer = void 0;
|
|
4
|
+
const SwaggerTypeChecker_1 = require("./SwaggerTypeChecker");
|
|
5
|
+
var SwaggerComponentsExplorer;
|
|
6
|
+
(function (SwaggerComponentsExplorer) {
|
|
7
|
+
SwaggerComponentsExplorer.getParameter = (components) => (schema) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
return SwaggerTypeChecker_1.SwaggerTypeChecker.isReference(schema) &&
|
|
10
|
+
schema.$ref.startsWith("#/components/parameters/")
|
|
11
|
+
? (_b = (_a = components.parameters) === null || _a === void 0 ? void 0 : _a[schema.$ref.replace("#/components/parameters/", "")]) !== null && _b !== void 0 ? _b : null
|
|
12
|
+
: schema;
|
|
13
|
+
};
|
|
14
|
+
SwaggerComponentsExplorer.getRequestBody = (components) => (schema) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return SwaggerTypeChecker_1.SwaggerTypeChecker.isReference(schema) &&
|
|
17
|
+
schema.$ref.startsWith("#/components/requestBodies/")
|
|
18
|
+
? (_b = (_a = components.requestBodies) === null || _a === void 0 ? void 0 : _a[schema.$ref.replace("#/components/requestBodies/", "")]) !== null && _b !== void 0 ? _b : null
|
|
19
|
+
: schema;
|
|
20
|
+
};
|
|
21
|
+
SwaggerComponentsExplorer.getResponse = (components) => (schema) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return SwaggerTypeChecker_1.SwaggerTypeChecker.isReference(schema) &&
|
|
24
|
+
schema.$ref.startsWith("#/components/responses/")
|
|
25
|
+
? (_b = (_a = components.responses) === null || _a === void 0 ? void 0 : _a[schema.$ref.replace("#/components/responses/", "")]) !== null && _b !== void 0 ? _b : null
|
|
26
|
+
: schema;
|
|
27
|
+
};
|
|
28
|
+
})(SwaggerComponentsExplorer || (exports.SwaggerComponentsExplorer = SwaggerComponentsExplorer = {}));
|
|
29
|
+
//# sourceMappingURL=SwaggerComponentsExplorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwaggerComponentsExplorer.js","sourceRoot":"","sources":["../../src/utils/SwaggerComponentsExplorer.ts"],"names":[],"mappings":";;;AAIA,6DAA0D;AAE1D,IAAiB,yBAAyB,CAoCzC;AApCD,WAAiB,yBAAyB;IAC3B,sCAAY,G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ameter } from "../structures/ISwaggerRouteParameter";
|
|
3
2
|
import { ISwaggerSchema } from "../structures/ISwaggerSchema";
|
|
4
3
|
export declare namespace SwaggerTypeChecker {
|
|
5
4
|
const isAnyOf: (schema: ISwaggerSchema) => schema is ISwaggerSchema.IAnyOf;
|
|
@@ -14,5 +13,4 @@ export declare namespace SwaggerTypeChecker {
|
|
|
14
13
|
const isReference: (schema: ISwaggerSchema) => schema is ISwaggerSchema.IReference;
|
|
15
14
|
const isUnknown: (schema: ISwaggerSchema) => schema is ISwaggerSchema.IUnknown;
|
|
16
15
|
const isNullable: (components: ISwaggerComponents) => (schema: ISwaggerSchema) => boolean;
|
|
17
|
-
const getParameter: (components: ISwaggerComponents) => (schema: ISwaggerRouteParameter | ISwaggerRouteParameter.IReference) => ISwaggerRouteParameter | null;
|
|
18
16
|
}
|
|
@@ -30,11 +30,5 @@ var SwaggerTypeChecker;
|
|
|
30
30
|
}
|
|
31
31
|
return schema.nullable === true;
|
|
32
32
|
};
|
|
33
|
-
SwaggerTypeChecker.getParameter = (components) => (schema) => {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
return SwaggerTypeChecker.isReference(schema) && schema.$ref.startsWith("#/components/parameters/")
|
|
36
|
-
? (_b = (_a = components.parameters) === null || _a === void 0 ? void 0 : _a[schema.$ref.replace("#/components/parameters/", "")]) !== null && _b !== void 0 ? _b : null
|
|
37
|
-
: schema;
|
|
38
|
-
};
|
|
39
33
|
})(SwaggerTypeChecker || (exports.SwaggerTypeChecker = SwaggerTypeChecker = {}));
|
|
40
34
|
//# sourceMappingURL=SwaggerTypeChecker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerTypeChecker.js","sourceRoot":"","sources":["../../src/utils/SwaggerTypeChecker.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SwaggerTypeChecker.js","sourceRoot":"","sources":["../../src/utils/SwaggerTypeChecker.ts"],"names":[],"mappings":";;;AAGA,IAAiB,kB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AO,CAAC,MAAM,CAAC;YACpC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAA,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;aAC9C,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC;YACzC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAA,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;aAC9C,IAAI,kBAAkB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;YAC7D,MAAM,MAAM,GAAG,CAAC,MAAA,UAAU,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/C,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAA,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;QACD,OAAQ,MAAiC,CAAC,QAAQ,KAAK,IAAI,CAAC;IAC9D,CAAC,CAAC;AACN,CAAC,EA/DgB,kBAAkB,kCAAlB,kBAAkB,QA+DlC"}
|
package/package.json
CHANGED
|
@@ -1,74 +1,78 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nestia/migrate",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Migration program from swagger to NestJS",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"typings": "lib/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"@nestia/migrate": "lib/executable/migrate.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "rimraf lib && tsc",
|
|
12
|
-
"bundle": "ts-node src/executable/bundle.ts",
|
|
13
|
-
"dev": "npm run build -- --watch",
|
|
14
|
-
"package:next": "npm publish --access public --tag next",
|
|
15
|
-
"prepare": "ts-patch install && typia patch && npm run bundle",
|
|
16
|
-
"test": "node lib/test"
|
|
17
|
-
},
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "https://github.com/samchon/nestia"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"migration",
|
|
24
|
-
"swagger",
|
|
25
|
-
"NestJS",
|
|
26
|
-
"nestia",
|
|
27
|
-
"SDK",
|
|
28
|
-
"Mockup Simulator"
|
|
29
|
-
],
|
|
30
|
-
"author": "Jeongho Nam",
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "https://github.com/samchon/nestia/issues"
|
|
34
|
-
},
|
|
35
|
-
"homepage": "https://nestia.io",
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@nestia/core": "^2.
|
|
38
|
-
"@nestia/e2e": "^0.4.1",
|
|
39
|
-
"@nestia/fetcher": "^2.
|
|
40
|
-
"@nestjs/common": "^10.3.
|
|
41
|
-
"@nestjs/core": "^10.3.
|
|
42
|
-
"@nestjs/platform-express": "^10.3.
|
|
43
|
-
"@nestjs/platform-fastify": "^10.3.
|
|
44
|
-
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
45
|
-
"@types/express": "^4.17.21",
|
|
46
|
-
"@types/inquirer": "^9.0.7",
|
|
47
|
-
"@types/node": "^20.3.3",
|
|
48
|
-
"
|
|
49
|
-
"dotenv
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"ts-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@nestia/migrate",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "Migration program from swagger to NestJS",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"@nestia/migrate": "lib/executable/migrate.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rimraf lib && tsc",
|
|
12
|
+
"bundle": "ts-node src/executable/bundle.ts",
|
|
13
|
+
"dev": "npm run build -- --watch",
|
|
14
|
+
"package:next": "npm publish --access public --tag next",
|
|
15
|
+
"prepare": "ts-patch install && typia patch && npm run bundle",
|
|
16
|
+
"test": "node lib/test"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/samchon/nestia"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"migration",
|
|
24
|
+
"swagger",
|
|
25
|
+
"NestJS",
|
|
26
|
+
"nestia",
|
|
27
|
+
"SDK",
|
|
28
|
+
"Mockup Simulator"
|
|
29
|
+
],
|
|
30
|
+
"author": "Jeongho Nam",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/samchon/nestia/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://nestia.io",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@nestia/core": "^2.6.0",
|
|
38
|
+
"@nestia/e2e": "^0.4.1",
|
|
39
|
+
"@nestia/fetcher": "^2.6.0",
|
|
40
|
+
"@nestjs/common": "^10.3.5",
|
|
41
|
+
"@nestjs/core": "^10.3.5",
|
|
42
|
+
"@nestjs/platform-express": "^10.3.5",
|
|
43
|
+
"@nestjs/platform-fastify": "^10.3.5",
|
|
44
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
45
|
+
"@types/express": "^4.17.21",
|
|
46
|
+
"@types/inquirer": "^9.0.7",
|
|
47
|
+
"@types/node": "^20.3.3",
|
|
48
|
+
"@types/swagger2openapi": "^7.0.4",
|
|
49
|
+
"dotenv": "^16.3.1",
|
|
50
|
+
"dotenv-expand": "^10.0.0",
|
|
51
|
+
"rimraf": "^5.0.1",
|
|
52
|
+
"serialize-error": "^4.1.0",
|
|
53
|
+
"source-map-support": "^0.5.21",
|
|
54
|
+
"ts-node": "^10.9.1",
|
|
55
|
+
"ts-patch": "^3.1.0",
|
|
56
|
+
"typescript-transform-paths": "^3.4.6"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@apiture/openapi-down-convert": "^0.13.0",
|
|
60
|
+
"commander": "10.0.0",
|
|
61
|
+
"inquirer": "8.2.5",
|
|
62
|
+
"openapi-types": "^12.1.3",
|
|
63
|
+
"prettier": "^3.2.5",
|
|
64
|
+
"swagger2openapi": "^7.0.8",
|
|
65
|
+
"tstl": "^2.5.13",
|
|
66
|
+
"typescript": "^5.4.2",
|
|
67
|
+
"typia": "^5.5.7"
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"lib",
|
|
71
|
+
"src",
|
|
72
|
+
"!lib/test",
|
|
73
|
+
"!src/test",
|
|
74
|
+
"package.json",
|
|
75
|
+
"README.md",
|
|
76
|
+
"LICENSE"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
@@ -10,19 +10,28 @@ import { MigrateNestProgrammer } from "./programmers/MigrateNestProgrammer";
|
|
|
10
10
|
import { IMigrateFile } from "./structures/IMigrateFile";
|
|
11
11
|
import { IMigrateProgram } from "./structures/IMigrateProgram";
|
|
12
12
|
import { ISwagger } from "./structures/ISwagger";
|
|
13
|
+
import { ISwaggerV20 } from "./structures/ISwaggerV20";
|
|
14
|
+
import { ISwaggerV31 } from "./structures/ISwaggerV31";
|
|
15
|
+
import { OpenApiConverter } from "./utils/OpenApiConverter";
|
|
13
16
|
|
|
14
17
|
export class MigrateApplication {
|
|
15
18
|
private constructor(public readonly swagger: ISwagger) {}
|
|
16
19
|
|
|
17
|
-
public static create(
|
|
20
|
+
public static async create(
|
|
21
|
+
swagger: ISwagger | ISwaggerV20 | ISwaggerV31,
|
|
22
|
+
): Promise<IValidation<MigrateApplication>> {
|
|
23
|
+
swagger = typia.is<ISwaggerV20.IVersion>(swagger)
|
|
24
|
+
? await OpenApiConverter.v2_0(swagger)
|
|
25
|
+
: typia.is<ISwaggerV31.IVersion>(swagger)
|
|
26
|
+
? OpenApiConverter.v3_1(swagger)
|
|
27
|
+
: swagger;
|
|
18
28
|
const result = typia.validate<ISwagger>(swagger);
|
|
19
|
-
if (result.success)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return result;
|
|
29
|
+
if (result.success === false) return result;
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
data: new MigrateApplication(swagger),
|
|
33
|
+
errors: [],
|
|
34
|
+
};
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
public nest(config: MigrateApplication.IConfig): MigrateApplication.IOutput {
|
|
@@ -5,9 +5,12 @@ import { IMigrateProgram } from "../structures/IMigrateProgram";
|
|
|
5
5
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
|
6
6
|
import { ISwagger } from "../structures/ISwagger";
|
|
7
7
|
import { ISwaggerRoute } from "../structures/ISwaggerRoute";
|
|
8
|
+
import { ISwaggerRouteBodyContent } from "../structures/ISwaggerRouteBodyContent";
|
|
8
9
|
import { ISwaggerRouteParameter } from "../structures/ISwaggerRouteParameter";
|
|
10
|
+
import { ISwaggerRouteResponse } from "../structures/ISwaggerRouteResponse";
|
|
9
11
|
import { ISwaggerSchema } from "../structures/ISwaggerSchema";
|
|
10
12
|
import { StringUtil } from "../utils/StringUtil";
|
|
13
|
+
import { SwaggerComponentsExplorer } from "../utils/SwaggerComponentsExplorer";
|
|
11
14
|
import { SwaggerTypeChecker } from "../utils/SwaggerTypeChecker";
|
|
12
15
|
|
|
13
16
|
export namespace MigrateMethodAnalzyer {
|
|
@@ -21,19 +24,46 @@ export namespace MigrateMethodAnalzyer {
|
|
|
21
24
|
const success = emplaceBodySchema("response")(
|
|
22
25
|
emplaceReference(props.swagger)("response"),
|
|
23
26
|
)(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
(() => {
|
|
28
|
+
const response =
|
|
29
|
+
route.responses?.["201"] ??
|
|
30
|
+
route.responses?.["200"] ??
|
|
31
|
+
route.responses?.default;
|
|
32
|
+
if (response === undefined) return undefined;
|
|
33
|
+
SwaggerComponentsExplorer.getResponse(props.swagger.components)(
|
|
34
|
+
response,
|
|
35
|
+
) ?? undefined;
|
|
36
|
+
})(),
|
|
27
37
|
);
|
|
28
38
|
|
|
29
39
|
const failures: string[] = [];
|
|
30
40
|
for (const p of route.parameters ?? [])
|
|
31
41
|
if (
|
|
32
|
-
|
|
42
|
+
SwaggerComponentsExplorer.getParameter(props.swagger.components)(
|
|
43
|
+
p,
|
|
44
|
+
) === null
|
|
33
45
|
)
|
|
34
46
|
failures.push(
|
|
35
47
|
`parameter "${(p as ISwaggerRouteParameter.IReference).$ref}" is not defined in "components.parameters".`,
|
|
36
48
|
);
|
|
49
|
+
for (const value of Object.values(route.responses ?? {}))
|
|
50
|
+
if (
|
|
51
|
+
SwaggerComponentsExplorer.getResponse(props.swagger.components)(
|
|
52
|
+
value,
|
|
53
|
+
) === null
|
|
54
|
+
)
|
|
55
|
+
failures.push(
|
|
56
|
+
`response "${(value as ISwaggerRouteResponse.IReference).$ref}" is not defined in "components.responses".`,
|
|
57
|
+
);
|
|
58
|
+
if (
|
|
59
|
+
route.requestBody &&
|
|
60
|
+
SwaggerComponentsExplorer.getRequestBody(props.swagger.components)(
|
|
61
|
+
route.requestBody,
|
|
62
|
+
) === null
|
|
63
|
+
)
|
|
64
|
+
failures.push(
|
|
65
|
+
`requestBody "${(route.requestBody as ISwaggerRouteParameter.IReference).$ref}" is not defined in "components.requestBodies".`,
|
|
66
|
+
);
|
|
37
67
|
if (body === false)
|
|
38
68
|
failures.push(
|
|
39
69
|
`supports only "application/json", "application/x-www-form-urlencoded", "multipart/form-data" and "text/plain" content type in the request body.`,
|
|
@@ -51,12 +81,15 @@ export namespace MigrateMethodAnalzyer {
|
|
|
51
81
|
const parameters: ISwaggerRouteParameter[] = (route.parameters ?? [])
|
|
52
82
|
.filter(
|
|
53
83
|
(p) =>
|
|
54
|
-
|
|
55
|
-
|
|
84
|
+
SwaggerComponentsExplorer.getParameter(props.swagger.components)(
|
|
85
|
+
p,
|
|
86
|
+
)?.in === type,
|
|
56
87
|
)
|
|
57
88
|
.map(
|
|
58
89
|
(p) =>
|
|
59
|
-
|
|
90
|
+
SwaggerComponentsExplorer.getParameter(props.swagger.components)(
|
|
91
|
+
p,
|
|
92
|
+
)!,
|
|
60
93
|
);
|
|
61
94
|
if (parameters.length === 0) return null;
|
|
62
95
|
|
|
@@ -170,8 +203,8 @@ export namespace MigrateMethodAnalzyer {
|
|
|
170
203
|
parameterNames.length !==
|
|
171
204
|
(route.parameters ?? []).filter(
|
|
172
205
|
(p) =>
|
|
173
|
-
|
|
174
|
-
|
|
206
|
+
SwaggerComponentsExplorer.getParameter(props.swagger.components)(p)
|
|
207
|
+
?.in === "path",
|
|
175
208
|
).length
|
|
176
209
|
)
|
|
177
210
|
failures.push(
|
|
@@ -200,7 +233,7 @@ export namespace MigrateMethodAnalzyer {
|
|
|
200
233
|
: null,
|
|
201
234
|
parameters: (route.parameters ?? [])
|
|
202
235
|
.map((p) =>
|
|
203
|
-
|
|
236
|
+
SwaggerComponentsExplorer.getParameter(props.swagger.components)(p),
|
|
204
237
|
)
|
|
205
238
|
.filter((p) => p !== null && p.in === "path")
|
|
206
239
|
.map((p, i) => ({
|
|
@@ -234,15 +267,22 @@ export namespace MigrateMethodAnalzyer {
|
|
|
234
267
|
key !== "200" &&
|
|
235
268
|
key !== "201" &&
|
|
236
269
|
key !== "default" &&
|
|
237
|
-
!!
|
|
270
|
+
!!SwaggerComponentsExplorer.getResponse(
|
|
271
|
+
props.swagger.components,
|
|
272
|
+
)(value)?.content?.["application/json"],
|
|
238
273
|
)
|
|
239
|
-
.map(([key, value]) =>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
274
|
+
.map(([key, value]) => {
|
|
275
|
+
const r = SwaggerComponentsExplorer.getResponse(
|
|
276
|
+
props.swagger.components,
|
|
277
|
+
)(value)!;
|
|
278
|
+
return [
|
|
279
|
+
key,
|
|
280
|
+
{
|
|
281
|
+
description: r.description,
|
|
282
|
+
schema: r.content?.["application/json"]?.schema ?? {},
|
|
283
|
+
},
|
|
284
|
+
];
|
|
285
|
+
}),
|
|
246
286
|
),
|
|
247
287
|
deprecated: route.deprecated ?? false,
|
|
248
288
|
comment: () => describe(props.swagger)(route),
|
|
@@ -314,7 +354,7 @@ export namespace MigrateMethodAnalzyer {
|
|
|
314
354
|
(emplacer: (schema: ISwaggerSchema) => ISwaggerSchema.IReference) =>
|
|
315
355
|
(meta?: {
|
|
316
356
|
description?: string;
|
|
317
|
-
content?:
|
|
357
|
+
content?: ISwaggerRouteBodyContent;
|
|
318
358
|
"x-nestia-encrypted"?: boolean;
|
|
319
359
|
}): false | null | IMigrateRoute.IBody => {
|
|
320
360
|
if (!meta?.content) return null;
|
|
@@ -47,7 +47,7 @@ export const NEST_TEMPLATE = [
|
|
|
47
47
|
{
|
|
48
48
|
"location": "",
|
|
49
49
|
"file": "package.json",
|
|
50
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.2\",\r\n \"@nestia/sdk\": \"^2.5.16\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^6.19.1\",\r\n \"@typescript-eslint/parser\": \"^6.19.1\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^2.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.3.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.3.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.5.16\",\r\n \"@nestia/fetcher\": \"^2.5.16\",\r\n \"@nestjs/common\": \"^10.3.
|
|
50
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.2\",\r\n \"@nestia/sdk\": \"^2.5.16\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^6.19.1\",\r\n \"@typescript-eslint/parser\": \"^6.19.1\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^2.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.3.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.3.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.5.16\",\r\n \"@nestia/fetcher\": \"^2.5.16\",\r\n \"@nestjs/common\": \"^10.3.5\",\r\n \"@nestjs/core\": \"^10.3.5\",\r\n \"@nestjs/platform-express\": \"^10.3.5\",\r\n \"commander\": \"10.0.0\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^5.5.7\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"location": "packages/api",
|
|
@@ -35,7 +35,7 @@ export namespace MigrateCommander {
|
|
|
35
35
|
})();
|
|
36
36
|
|
|
37
37
|
const result: IValidation<MigrateApplication> =
|
|
38
|
-
MigrateApplication.create(swagger);
|
|
38
|
+
await MigrateApplication.create(swagger);
|
|
39
39
|
if (result.success === false) {
|
|
40
40
|
console.log(result.errors);
|
|
41
41
|
throw new Error(
|
|
@@ -239,7 +239,10 @@ export namespace MigrateSchemaProgrammer {
|
|
|
239
239
|
const name: string = schema.$ref.split("/").at(-1)!;
|
|
240
240
|
return name === ""
|
|
241
241
|
? TypeFactory.keyword("any")
|
|
242
|
-
: importer.dto(
|
|
242
|
+
: importer.dto(
|
|
243
|
+
schema.$ref.split("/").at(-1)!,
|
|
244
|
+
components["x-nestia-namespace"],
|
|
245
|
+
);
|
|
243
246
|
};
|
|
244
247
|
|
|
245
248
|
/* -----------------------------------------------------------
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ISwaggerComponents } from "./ISwaggerComponents";
|
|
2
|
-
import { ISwaggerInfo } from "./ISwaggerInfo";
|
|
3
|
-
import { ISwaggerRoute } from "./ISwaggerRoute";
|
|
4
|
-
|
|
5
|
-
export interface ISwagger {
|
|
6
|
-
openapi: `3.0.${number}`;
|
|
7
|
-
info: ISwaggerInfo;
|
|
8
|
-
servers: ISwagger.IServer[];
|
|
9
|
-
|
|
10
|
-
components: ISwaggerComponents;
|
|
11
|
-
paths: Record<string, ISwagger.IPath>;
|
|
12
|
-
security?: Record<string, string[]>[];
|
|
13
|
-
}
|
|
14
|
-
export namespace ISwagger {
|
|
15
|
-
export interface IServer {
|
|
16
|
-
url: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
}
|
|
19
|
-
export type IPath = Record<
|
|
20
|
-
"get" | "post" | "patch" | "put" | "delete",
|
|
21
|
-
ISwaggerRoute | undefined
|
|
22
|
-
>;
|
|
23
|
-
}
|
|
1
|
+
import { ISwaggerComponents } from "./ISwaggerComponents";
|
|
2
|
+
import { ISwaggerInfo } from "./ISwaggerInfo";
|
|
3
|
+
import { ISwaggerRoute } from "./ISwaggerRoute";
|
|
4
|
+
|
|
5
|
+
export interface ISwagger {
|
|
6
|
+
openapi: `3.0.${number}`;
|
|
7
|
+
info: ISwaggerInfo;
|
|
8
|
+
servers: ISwagger.IServer[];
|
|
9
|
+
|
|
10
|
+
components: ISwaggerComponents;
|
|
11
|
+
paths: Record<string, ISwagger.IPath>;
|
|
12
|
+
security?: Record<string, string[]>[];
|
|
13
|
+
}
|
|
14
|
+
export namespace ISwagger {
|
|
15
|
+
export interface IServer {
|
|
16
|
+
url: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
export type IPath = Record<
|
|
20
|
+
"get" | "post" | "patch" | "put" | "delete",
|
|
21
|
+
ISwaggerRoute | undefined
|
|
22
|
+
>;
|
|
23
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ISwaggerRouteParameter } from "./ISwaggerRouteParameter";
|
|
2
|
+
import { ISwaggerRouteRequestBody } from "./ISwaggerRouteRequestBody";
|
|
3
|
+
import { ISwaggerRouteResponse } from "./ISwaggerRouteResponse";
|
|
2
4
|
import { ISwaggerSchema } from "./ISwaggerSchema";
|
|
3
5
|
import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
|
|
4
6
|
|
|
5
7
|
export interface ISwaggerComponents {
|
|
6
8
|
parameters?: Record<string, ISwaggerRouteParameter>;
|
|
9
|
+
requestBodies?: Record<string, ISwaggerRouteRequestBody>;
|
|
10
|
+
responses?: Record<string, ISwaggerRouteResponse>;
|
|
7
11
|
schemas?: Record<string, ISwaggerSchema>;
|
|
8
12
|
securitySchemes?: Record<string, ISwaggerSecurityScheme>;
|
|
9
|
-
namespace?: string;
|
|
13
|
+
"x-nestia-namespace"?: string;
|
|
10
14
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
|
|
2
2
|
|
|
3
3
|
import { ISwaggerRouteParameter } from "./ISwaggerRouteParameter";
|
|
4
|
-
import {
|
|
4
|
+
import { ISwaggerRouteRequestBody } from "./ISwaggerRouteRequestBody";
|
|
5
|
+
import { ISwaggerRouteResponse } from "./ISwaggerRouteResponse";
|
|
5
6
|
|
|
6
7
|
export interface ISwaggerRoute {
|
|
7
8
|
parameters?: (ISwaggerRouteParameter | ISwaggerRouteParameter.IReference)[];
|
|
8
|
-
requestBody?:
|
|
9
|
-
responses?:
|
|
9
|
+
requestBody?: ISwaggerRouteRequestBody;
|
|
10
|
+
responses?: Record<
|
|
11
|
+
string,
|
|
12
|
+
ISwaggerRouteResponse | ISwaggerRouteResponse.IReference
|
|
13
|
+
>;
|
|
10
14
|
summary?: string;
|
|
11
15
|
description?: string;
|
|
12
16
|
deprecated?: boolean;
|
|
@@ -14,36 +18,3 @@ export interface ISwaggerRoute {
|
|
|
14
18
|
tags?: string[];
|
|
15
19
|
"x-nestia-jsDocTags"?: IJsDocTagInfo[];
|
|
16
20
|
}
|
|
17
|
-
export namespace ISwaggerRoute {
|
|
18
|
-
export interface IRequestBody {
|
|
19
|
-
description?: string;
|
|
20
|
-
content: IContent;
|
|
21
|
-
required?: boolean;
|
|
22
|
-
"x-nestia-encrypted"?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export type IResponseBody = Record<
|
|
25
|
-
string,
|
|
26
|
-
{
|
|
27
|
-
description?: string;
|
|
28
|
-
content?: IContent;
|
|
29
|
-
"x-nestia-encrypted"?: boolean;
|
|
30
|
-
}
|
|
31
|
-
>;
|
|
32
|
-
export interface IContent {
|
|
33
|
-
"text/plain"?: {
|
|
34
|
-
schema: ISwaggerSchema;
|
|
35
|
-
};
|
|
36
|
-
"application/json"?: {
|
|
37
|
-
schema: ISwaggerSchema;
|
|
38
|
-
};
|
|
39
|
-
"application/x-www-form-urlencoded"?: {
|
|
40
|
-
schema: ISwaggerSchema;
|
|
41
|
-
};
|
|
42
|
-
"multipart/form-data"?: {
|
|
43
|
-
schema: ISwaggerSchema;
|
|
44
|
-
};
|
|
45
|
-
"*/*"?: {
|
|
46
|
-
schema: ISwaggerSchema;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ISwaggerSchema } from "./ISwaggerSchema";
|
|
2
|
+
|
|
3
|
+
export interface ISwaggerRouteBodyContent {
|
|
4
|
+
"text/plain"?: ISwaggerRouteBodyContent.IMediaType;
|
|
5
|
+
"application/json"?: ISwaggerRouteBodyContent.IMediaType;
|
|
6
|
+
"application/x-www-form-urlencoded"?: ISwaggerRouteBodyContent.IMediaType;
|
|
7
|
+
"multipart/form-data"?: ISwaggerRouteBodyContent.IMediaType;
|
|
8
|
+
"*/*"?: ISwaggerRouteBodyContent.IMediaType;
|
|
9
|
+
}
|
|
10
|
+
export namespace ISwaggerRouteBodyContent {
|
|
11
|
+
export interface IMediaType {
|
|
12
|
+
schema?: ISwaggerSchema;
|
|
13
|
+
"x-nestia-encrypted"?: boolean;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISwaggerRouteBodyContent } from "./ISwaggerRouteBodyContent";
|
|
2
|
+
|
|
3
|
+
export interface ISwaggerRouteRequestBody {
|
|
4
|
+
description?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
content?: ISwaggerRouteBodyContent;
|
|
7
|
+
}
|
|
8
|
+
export namespace ISwaggerRouteRequestBody {
|
|
9
|
+
export interface IReference {
|
|
10
|
+
$ref: `#/components/requestBodies/${string}`;
|
|
11
|
+
}
|
|
12
|
+
}
|