@nestia/sdk 2.5.0-dev.20240131 → 2.5.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/executable/sdk.js +11 -11
- package/lib/generates/SdkGenerator.js +0 -8
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.js +5 -4
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +0 -7
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkFunctionProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkFunctionProgrammer.js +3 -3
- package/lib/generates/internal/SdkFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkNamespaceProgrammer.js +1 -1
- package/lib/generates/internal/SdkNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkRouteProgrammer.js +2 -2
- package/lib/generates/internal/SdkRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkSimulationProgrammer.js +3 -3
- package/lib/generates/internal/SdkSimulationProgrammer.js.map +1 -1
- package/package.json +3 -3
- package/src/analyses/AccessorAnalyzer.ts +60 -60
- package/src/analyses/ConfigAnalyzer.ts +147 -147
- package/src/analyses/GenericAnalyzer.ts +51 -51
- package/src/analyses/ImportAnalyzer.ts +138 -138
- package/src/analyses/PathAnalyzer.ts +110 -110
- package/src/analyses/ReflectAnalyzer.ts +464 -464
- package/src/analyses/SecurityAnalyzer.ts +20 -20
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigLoader.ts +67 -67
- package/src/executable/internal/NestiaSdkCommand.ts +60 -60
- package/src/executable/sdk.ts +73 -73
- package/src/generates/SdkGenerator.ts +0 -12
- package/src/generates/internal/SdkAliasCollection.ts +4 -3
- package/src/generates/internal/SdkDistributionComposer.ts +91 -91
- package/src/generates/internal/SdkFileProgrammer.ts +0 -9
- package/src/generates/internal/SdkFunctionProgrammer.ts +3 -3
- package/src/generates/internal/SdkNamespaceProgrammer.ts +1 -1
- package/src/generates/internal/SdkRouteDirectory.ts +17 -17
- package/src/generates/internal/SdkRouteProgrammer.ts +2 -2
- package/src/generates/internal/SdkSimulationProgrammer.ts +3 -3
- package/src/generates/internal/SwaggerSchemaGenerator.ts +444 -444
- package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
- package/src/index.ts +4 -4
- package/src/module.ts +2 -2
- package/src/structures/IController.ts +91 -91
- package/src/structures/IErrorReport.ts +6 -6
- package/src/structures/INestiaProject.ts +13 -13
- package/src/structures/INormalizedInput.ts +20 -20
- package/src/structures/IRoute.ts +52 -52
- package/src/structures/ISwaggerComponents.ts +29 -29
- package/src/structures/ISwaggerError.ts +8 -8
- package/src/structures/ISwaggerInfo.ts +80 -80
- package/src/structures/ISwaggerLazyProperty.ts +7 -7
- package/src/structures/ISwaggerLazySchema.ts +7 -7
- package/src/structures/ISwaggerRoute.ts +51 -51
- package/src/structures/ISwaggerSecurityScheme.ts +65 -65
- package/src/structures/ITypeTuple.ts +6 -6
- package/src/structures/MethodType.ts +5 -5
- package/src/structures/ParamCategory.ts +1 -1
- package/src/structures/TypeEntry.ts +22 -22
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/FileRetriever.ts +22 -22
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/PathUtil.ts +10 -10
- package/src/utils/SourceFinder.ts +66 -66
- package/src/utils/StripEnums.ts +5 -5
- package/assets/bundle/api/utils/NestiaSimulator.ts +0 -70
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { RouteInfo, VersionValue } from "@nestjs/common/interfaces";
|
|
2
|
-
|
|
3
|
-
export interface INormalizedInput {
|
|
4
|
-
include: INormalizedInput.IInput[];
|
|
5
|
-
globalPrefix?: {
|
|
6
|
-
prefix: string;
|
|
7
|
-
exclude?: Array<string | RouteInfo>;
|
|
8
|
-
};
|
|
9
|
-
versioning?: {
|
|
10
|
-
prefix: string;
|
|
11
|
-
defaultVersion?: VersionValue;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export namespace INormalizedInput {
|
|
15
|
-
export interface IInput {
|
|
16
|
-
paths: string[];
|
|
17
|
-
file: string;
|
|
18
|
-
controller?: Function;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { RouteInfo, VersionValue } from "@nestjs/common/interfaces";
|
|
2
|
+
|
|
3
|
+
export interface INormalizedInput {
|
|
4
|
+
include: INormalizedInput.IInput[];
|
|
5
|
+
globalPrefix?: {
|
|
6
|
+
prefix: string;
|
|
7
|
+
exclude?: Array<string | RouteInfo>;
|
|
8
|
+
};
|
|
9
|
+
versioning?: {
|
|
10
|
+
prefix: string;
|
|
11
|
+
defaultVersion?: VersionValue;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export namespace INormalizedInput {
|
|
15
|
+
export interface IInput {
|
|
16
|
+
paths: string[];
|
|
17
|
+
file: string;
|
|
18
|
+
controller?: Function;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/structures/IRoute.ts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
3
|
-
|
|
4
|
-
import { IController } from "./IController";
|
|
5
|
-
|
|
6
|
-
export interface IRoute {
|
|
7
|
-
name: string;
|
|
8
|
-
method: string;
|
|
9
|
-
path: string;
|
|
10
|
-
encrypted: boolean;
|
|
11
|
-
status?: number;
|
|
12
|
-
|
|
13
|
-
accessors: string[];
|
|
14
|
-
parameters: IRoute.IParameter[];
|
|
15
|
-
imports: [string, string[]][];
|
|
16
|
-
output: IRoute.IOutput;
|
|
17
|
-
|
|
18
|
-
location: string;
|
|
19
|
-
symbol: {
|
|
20
|
-
class: string;
|
|
21
|
-
function: string;
|
|
22
|
-
};
|
|
23
|
-
description?: string;
|
|
24
|
-
operationId?: string;
|
|
25
|
-
jsDocTags: ts.JSDocTagInfo[];
|
|
26
|
-
setHeaders: Array<
|
|
27
|
-
| { type: "setter"; source: string; target?: string }
|
|
28
|
-
| { type: "assigner"; source: string }
|
|
29
|
-
>;
|
|
30
|
-
security: Record<string, string[]>[];
|
|
31
|
-
exceptions: Record<number | "2XX" | "3XX" | "4XX" | "5XX", IRoute.IOutput>;
|
|
32
|
-
swaggerTags: string[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export namespace IRoute {
|
|
36
|
-
export type IParameter = IController.IParameter & {
|
|
37
|
-
optional: boolean;
|
|
38
|
-
type: ts.Type;
|
|
39
|
-
typeName: string;
|
|
40
|
-
metadata?: Metadata;
|
|
41
|
-
};
|
|
42
|
-
export interface IOutput {
|
|
43
|
-
type: ts.Type;
|
|
44
|
-
typeName: string;
|
|
45
|
-
metadata?: Metadata;
|
|
46
|
-
description?: string;
|
|
47
|
-
contentType:
|
|
48
|
-
| "application/x-www-form-urlencoded"
|
|
49
|
-
| "application/json"
|
|
50
|
-
| "text/plain";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
3
|
+
|
|
4
|
+
import { IController } from "./IController";
|
|
5
|
+
|
|
6
|
+
export interface IRoute {
|
|
7
|
+
name: string;
|
|
8
|
+
method: string;
|
|
9
|
+
path: string;
|
|
10
|
+
encrypted: boolean;
|
|
11
|
+
status?: number;
|
|
12
|
+
|
|
13
|
+
accessors: string[];
|
|
14
|
+
parameters: IRoute.IParameter[];
|
|
15
|
+
imports: [string, string[]][];
|
|
16
|
+
output: IRoute.IOutput;
|
|
17
|
+
|
|
18
|
+
location: string;
|
|
19
|
+
symbol: {
|
|
20
|
+
class: string;
|
|
21
|
+
function: string;
|
|
22
|
+
};
|
|
23
|
+
description?: string;
|
|
24
|
+
operationId?: string;
|
|
25
|
+
jsDocTags: ts.JSDocTagInfo[];
|
|
26
|
+
setHeaders: Array<
|
|
27
|
+
| { type: "setter"; source: string; target?: string }
|
|
28
|
+
| { type: "assigner"; source: string }
|
|
29
|
+
>;
|
|
30
|
+
security: Record<string, string[]>[];
|
|
31
|
+
exceptions: Record<number | "2XX" | "3XX" | "4XX" | "5XX", IRoute.IOutput>;
|
|
32
|
+
swaggerTags: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export namespace IRoute {
|
|
36
|
+
export type IParameter = IController.IParameter & {
|
|
37
|
+
optional: boolean;
|
|
38
|
+
type: ts.Type;
|
|
39
|
+
typeName: string;
|
|
40
|
+
metadata?: Metadata;
|
|
41
|
+
};
|
|
42
|
+
export interface IOutput {
|
|
43
|
+
type: ts.Type;
|
|
44
|
+
typeName: string;
|
|
45
|
+
metadata?: Metadata;
|
|
46
|
+
description?: string;
|
|
47
|
+
contentType:
|
|
48
|
+
| "application/x-www-form-urlencoded"
|
|
49
|
+
| "application/json"
|
|
50
|
+
| "text/plain";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { IJsonComponents } from "typia";
|
|
2
|
-
|
|
3
|
-
import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Reusable components in Swagger.
|
|
7
|
-
*
|
|
8
|
-
* `ISwaggerComponents` is a data structure representing content of `components` object
|
|
9
|
-
* in `swagger.json` file generated by Nestia. Note that, this is not an universal
|
|
10
|
-
* structure, but a dedicated structure only for Nestia.
|
|
11
|
-
*
|
|
12
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
13
|
-
*/
|
|
14
|
-
export interface ISwaggerComponents {
|
|
15
|
-
/**
|
|
16
|
-
* An object to hold reusable DTO schemas.
|
|
17
|
-
*
|
|
18
|
-
* For reference, `nestia` stores every object and alias types as reusable DTO
|
|
19
|
-
* schemas. The alias type means that defined by `type` keyword in TypeScript.
|
|
20
|
-
*/
|
|
21
|
-
schemas?: Record<string, IJsonComponents.IAlias>;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* An object to hold reusable security schemes.
|
|
25
|
-
*
|
|
26
|
-
* This property be configured by user in `nestia.config.ts` file.
|
|
27
|
-
*/
|
|
28
|
-
securitySchemes?: Record<string, ISwaggerSecurityScheme>;
|
|
29
|
-
}
|
|
1
|
+
import { IJsonComponents } from "typia";
|
|
2
|
+
|
|
3
|
+
import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reusable components in Swagger.
|
|
7
|
+
*
|
|
8
|
+
* `ISwaggerComponents` is a data structure representing content of `components` object
|
|
9
|
+
* in `swagger.json` file generated by Nestia. Note that, this is not an universal
|
|
10
|
+
* structure, but a dedicated structure only for Nestia.
|
|
11
|
+
*
|
|
12
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
13
|
+
*/
|
|
14
|
+
export interface ISwaggerComponents {
|
|
15
|
+
/**
|
|
16
|
+
* An object to hold reusable DTO schemas.
|
|
17
|
+
*
|
|
18
|
+
* For reference, `nestia` stores every object and alias types as reusable DTO
|
|
19
|
+
* schemas. The alias type means that defined by `type` keyword in TypeScript.
|
|
20
|
+
*/
|
|
21
|
+
schemas?: Record<string, IJsonComponents.IAlias>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An object to hold reusable security schemes.
|
|
25
|
+
*
|
|
26
|
+
* This property be configured by user in `nestia.config.ts` file.
|
|
27
|
+
*/
|
|
28
|
+
securitySchemes?: Record<string, ISwaggerSecurityScheme>;
|
|
29
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
|
|
2
|
-
|
|
3
|
-
import { IRoute } from "./IRoute";
|
|
4
|
-
|
|
5
|
-
export interface ISwaggerError extends MetadataFactory.IError {
|
|
6
|
-
route: IRoute;
|
|
7
|
-
from: string;
|
|
8
|
-
}
|
|
1
|
+
import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
|
|
2
|
+
|
|
3
|
+
import { IRoute } from "./IRoute";
|
|
4
|
+
|
|
5
|
+
export interface ISwaggerError extends MetadataFactory.IError {
|
|
6
|
+
route: IRoute;
|
|
7
|
+
from: string;
|
|
8
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Information about the API.
|
|
3
|
-
*
|
|
4
|
-
* @author Samchon
|
|
5
|
-
*/
|
|
6
|
-
export interface ISwaggerInfo {
|
|
7
|
-
/**
|
|
8
|
-
* The title of the API.
|
|
9
|
-
*/
|
|
10
|
-
title: string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A short description of the API.
|
|
14
|
-
*/
|
|
15
|
-
description?: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A URL to the Terms of Service for the API.
|
|
19
|
-
*
|
|
20
|
-
* @format uri
|
|
21
|
-
*/
|
|
22
|
-
termsOfService?: string;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The contact information for the exposed API.
|
|
26
|
-
*/
|
|
27
|
-
contact?: ISwaggerInfo.IContact;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The license information for the exposed API.
|
|
31
|
-
*/
|
|
32
|
-
license?: ISwaggerInfo.ILicense;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Version of the API.
|
|
36
|
-
*/
|
|
37
|
-
version: string;
|
|
38
|
-
}
|
|
39
|
-
export namespace ISwaggerInfo {
|
|
40
|
-
/**
|
|
41
|
-
* Contact information for the exposed API.
|
|
42
|
-
*/
|
|
43
|
-
export interface IContact {
|
|
44
|
-
/**
|
|
45
|
-
* The identifying name of the contact person/organization.
|
|
46
|
-
*/
|
|
47
|
-
name?: string;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The URL pointing to the contact information.
|
|
51
|
-
*
|
|
52
|
-
* @format uri
|
|
53
|
-
*/
|
|
54
|
-
url?: string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The email address of the contact person/organization.
|
|
58
|
-
*
|
|
59
|
-
* @format email
|
|
60
|
-
*/
|
|
61
|
-
email?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* License information for the exposed API.
|
|
66
|
-
*/
|
|
67
|
-
export interface ILicense {
|
|
68
|
-
/**
|
|
69
|
-
* The license name used for the API.
|
|
70
|
-
*/
|
|
71
|
-
name: string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* A URL to the license used for the API.
|
|
75
|
-
*
|
|
76
|
-
* @format uri
|
|
77
|
-
*/
|
|
78
|
-
url?: string;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Information about the API.
|
|
3
|
+
*
|
|
4
|
+
* @author Samchon
|
|
5
|
+
*/
|
|
6
|
+
export interface ISwaggerInfo {
|
|
7
|
+
/**
|
|
8
|
+
* The title of the API.
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A short description of the API.
|
|
14
|
+
*/
|
|
15
|
+
description?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A URL to the Terms of Service for the API.
|
|
19
|
+
*
|
|
20
|
+
* @format uri
|
|
21
|
+
*/
|
|
22
|
+
termsOfService?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The contact information for the exposed API.
|
|
26
|
+
*/
|
|
27
|
+
contact?: ISwaggerInfo.IContact;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The license information for the exposed API.
|
|
31
|
+
*/
|
|
32
|
+
license?: ISwaggerInfo.ILicense;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Version of the API.
|
|
36
|
+
*/
|
|
37
|
+
version: string;
|
|
38
|
+
}
|
|
39
|
+
export namespace ISwaggerInfo {
|
|
40
|
+
/**
|
|
41
|
+
* Contact information for the exposed API.
|
|
42
|
+
*/
|
|
43
|
+
export interface IContact {
|
|
44
|
+
/**
|
|
45
|
+
* The identifying name of the contact person/organization.
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The URL pointing to the contact information.
|
|
51
|
+
*
|
|
52
|
+
* @format uri
|
|
53
|
+
*/
|
|
54
|
+
url?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The email address of the contact person/organization.
|
|
58
|
+
*
|
|
59
|
+
* @format email
|
|
60
|
+
*/
|
|
61
|
+
email?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* License information for the exposed API.
|
|
66
|
+
*/
|
|
67
|
+
export interface ILicense {
|
|
68
|
+
/**
|
|
69
|
+
* The license name used for the API.
|
|
70
|
+
*/
|
|
71
|
+
name: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A URL to the license used for the API.
|
|
75
|
+
*
|
|
76
|
+
* @format uri
|
|
77
|
+
*/
|
|
78
|
+
url?: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IJsonSchema } from "typia";
|
|
2
|
-
|
|
3
|
-
export interface ISwaggerLazyProperty {
|
|
4
|
-
schema: IJsonSchema;
|
|
5
|
-
object: string;
|
|
6
|
-
property: string;
|
|
7
|
-
}
|
|
1
|
+
import { IJsonSchema } from "typia";
|
|
2
|
+
|
|
3
|
+
export interface ISwaggerLazyProperty {
|
|
4
|
+
schema: IJsonSchema;
|
|
5
|
+
object: string;
|
|
6
|
+
property: string;
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IJsonSchema } from "typia";
|
|
2
|
-
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
3
|
-
|
|
4
|
-
export interface ISwaggerLazySchema {
|
|
5
|
-
metadata: Metadata;
|
|
6
|
-
schema: IJsonSchema;
|
|
7
|
-
}
|
|
1
|
+
import { IJsonSchema } from "typia";
|
|
2
|
+
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
3
|
+
|
|
4
|
+
export interface ISwaggerLazySchema {
|
|
5
|
+
metadata: Metadata;
|
|
6
|
+
schema: IJsonSchema;
|
|
7
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { IJsonSchema } from "typia";
|
|
2
|
-
import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
|
|
3
|
-
|
|
4
|
-
export interface ISwaggerRoute {
|
|
5
|
-
deprecated?: boolean;
|
|
6
|
-
security?: Record<string, string[]>[];
|
|
7
|
-
operationId?: string;
|
|
8
|
-
tags: string[];
|
|
9
|
-
parameters: ISwaggerRoute.IParameter[];
|
|
10
|
-
requestBody?: ISwaggerRoute.IRequestBody;
|
|
11
|
-
responses: ISwaggerRoute.IResponseBody;
|
|
12
|
-
summary?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
"x-nestia-method"?: string;
|
|
15
|
-
"x-nestia-namespace"?: string;
|
|
16
|
-
"x-nestia-jsDocTags"?: IJsDocTagInfo[];
|
|
17
|
-
}
|
|
18
|
-
export namespace ISwaggerRoute {
|
|
19
|
-
export interface IParameter {
|
|
20
|
-
name: string;
|
|
21
|
-
in: string;
|
|
22
|
-
schema: IJsonSchema;
|
|
23
|
-
required: boolean;
|
|
24
|
-
description?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface IRequestBody {
|
|
27
|
-
description?: string;
|
|
28
|
-
content: IContent;
|
|
29
|
-
required: true;
|
|
30
|
-
"x-nestia-encrypted"?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export type IResponseBody = Record<
|
|
33
|
-
string,
|
|
34
|
-
{
|
|
35
|
-
description: string;
|
|
36
|
-
content?: IContent;
|
|
37
|
-
"x-nestia-encrypted"?: boolean;
|
|
38
|
-
}
|
|
39
|
-
>;
|
|
40
|
-
export interface IContent {
|
|
41
|
-
"application/x-www-form-urlencoded"?: {
|
|
42
|
-
schema: IJsonSchema;
|
|
43
|
-
};
|
|
44
|
-
"application/json"?: {
|
|
45
|
-
schema: IJsonSchema;
|
|
46
|
-
};
|
|
47
|
-
"text/plain"?: {
|
|
48
|
-
schema: IJsonSchema;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
import { IJsonSchema } from "typia";
|
|
2
|
+
import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
|
|
3
|
+
|
|
4
|
+
export interface ISwaggerRoute {
|
|
5
|
+
deprecated?: boolean;
|
|
6
|
+
security?: Record<string, string[]>[];
|
|
7
|
+
operationId?: string;
|
|
8
|
+
tags: string[];
|
|
9
|
+
parameters: ISwaggerRoute.IParameter[];
|
|
10
|
+
requestBody?: ISwaggerRoute.IRequestBody;
|
|
11
|
+
responses: ISwaggerRoute.IResponseBody;
|
|
12
|
+
summary?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
"x-nestia-method"?: string;
|
|
15
|
+
"x-nestia-namespace"?: string;
|
|
16
|
+
"x-nestia-jsDocTags"?: IJsDocTagInfo[];
|
|
17
|
+
}
|
|
18
|
+
export namespace ISwaggerRoute {
|
|
19
|
+
export interface IParameter {
|
|
20
|
+
name: string;
|
|
21
|
+
in: string;
|
|
22
|
+
schema: IJsonSchema;
|
|
23
|
+
required: boolean;
|
|
24
|
+
description?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IRequestBody {
|
|
27
|
+
description?: string;
|
|
28
|
+
content: IContent;
|
|
29
|
+
required: true;
|
|
30
|
+
"x-nestia-encrypted"?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export type IResponseBody = Record<
|
|
33
|
+
string,
|
|
34
|
+
{
|
|
35
|
+
description: string;
|
|
36
|
+
content?: IContent;
|
|
37
|
+
"x-nestia-encrypted"?: boolean;
|
|
38
|
+
}
|
|
39
|
+
>;
|
|
40
|
+
export interface IContent {
|
|
41
|
+
"application/x-www-form-urlencoded"?: {
|
|
42
|
+
schema: IJsonSchema;
|
|
43
|
+
};
|
|
44
|
+
"application/json"?: {
|
|
45
|
+
schema: IJsonSchema;
|
|
46
|
+
};
|
|
47
|
+
"text/plain"?: {
|
|
48
|
+
schema: IJsonSchema;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security scheme of Swagger Documents.
|
|
3
|
-
*
|
|
4
|
-
* `ISwaggerSecurityScheme` is a data structure representing content of
|
|
5
|
-
* `securitySchemes` in `swagger.json` file. It is composed with 5 types of security
|
|
6
|
-
* schemes as an union type like below.
|
|
7
|
-
*
|
|
8
|
-
* @reference https://swagger.io/specification/#security-scheme-object
|
|
9
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
-
*/
|
|
11
|
-
export type ISwaggerSecurityScheme =
|
|
12
|
-
| ISwaggerSecurityScheme.IHttpBasic
|
|
13
|
-
| ISwaggerSecurityScheme.IHttpBearer
|
|
14
|
-
| ISwaggerSecurityScheme.IApiKey
|
|
15
|
-
| ISwaggerSecurityScheme.IOpenId
|
|
16
|
-
| ISwaggerSecurityScheme.IOAuth2;
|
|
17
|
-
export namespace ISwaggerSecurityScheme {
|
|
18
|
-
export interface IHttpBasic {
|
|
19
|
-
type: "http";
|
|
20
|
-
scheme: "basic";
|
|
21
|
-
}
|
|
22
|
-
export interface IHttpBearer {
|
|
23
|
-
type: "http";
|
|
24
|
-
scheme: "bearer";
|
|
25
|
-
bearerFormat?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface IApiKey {
|
|
28
|
-
type: "apiKey";
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @default header
|
|
32
|
-
*/
|
|
33
|
-
in?: "header" | "query" | "cookie";
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @default Authorization
|
|
37
|
-
*/
|
|
38
|
-
name?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IOpenId {
|
|
42
|
-
type: "openIdConnect";
|
|
43
|
-
openIdConnectUrl: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface IOAuth2 {
|
|
47
|
-
type: "oauth2";
|
|
48
|
-
flows: IOAuth2.IFlowSet;
|
|
49
|
-
description?: string;
|
|
50
|
-
}
|
|
51
|
-
export namespace IOAuth2 {
|
|
52
|
-
export interface IFlowSet {
|
|
53
|
-
authorizationCode?: IFlow;
|
|
54
|
-
implicit?: Omit<IFlow, "tokenUrl">;
|
|
55
|
-
password?: Omit<IFlow, "authorizationUrl">;
|
|
56
|
-
clientCredentials?: Omit<IFlow, "authorizationUrl">;
|
|
57
|
-
}
|
|
58
|
-
export interface IFlow {
|
|
59
|
-
authorizationUrl: string;
|
|
60
|
-
tokenUrl: string;
|
|
61
|
-
refreshUrl: string;
|
|
62
|
-
scopes?: Record<string, string>;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Security scheme of Swagger Documents.
|
|
3
|
+
*
|
|
4
|
+
* `ISwaggerSecurityScheme` is a data structure representing content of
|
|
5
|
+
* `securitySchemes` in `swagger.json` file. It is composed with 5 types of security
|
|
6
|
+
* schemes as an union type like below.
|
|
7
|
+
*
|
|
8
|
+
* @reference https://swagger.io/specification/#security-scheme-object
|
|
9
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
+
*/
|
|
11
|
+
export type ISwaggerSecurityScheme =
|
|
12
|
+
| ISwaggerSecurityScheme.IHttpBasic
|
|
13
|
+
| ISwaggerSecurityScheme.IHttpBearer
|
|
14
|
+
| ISwaggerSecurityScheme.IApiKey
|
|
15
|
+
| ISwaggerSecurityScheme.IOpenId
|
|
16
|
+
| ISwaggerSecurityScheme.IOAuth2;
|
|
17
|
+
export namespace ISwaggerSecurityScheme {
|
|
18
|
+
export interface IHttpBasic {
|
|
19
|
+
type: "http";
|
|
20
|
+
scheme: "basic";
|
|
21
|
+
}
|
|
22
|
+
export interface IHttpBearer {
|
|
23
|
+
type: "http";
|
|
24
|
+
scheme: "bearer";
|
|
25
|
+
bearerFormat?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface IApiKey {
|
|
28
|
+
type: "apiKey";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @default header
|
|
32
|
+
*/
|
|
33
|
+
in?: "header" | "query" | "cookie";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @default Authorization
|
|
37
|
+
*/
|
|
38
|
+
name?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IOpenId {
|
|
42
|
+
type: "openIdConnect";
|
|
43
|
+
openIdConnectUrl: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IOAuth2 {
|
|
47
|
+
type: "oauth2";
|
|
48
|
+
flows: IOAuth2.IFlowSet;
|
|
49
|
+
description?: string;
|
|
50
|
+
}
|
|
51
|
+
export namespace IOAuth2 {
|
|
52
|
+
export interface IFlowSet {
|
|
53
|
+
authorizationCode?: IFlow;
|
|
54
|
+
implicit?: Omit<IFlow, "tokenUrl">;
|
|
55
|
+
password?: Omit<IFlow, "authorizationUrl">;
|
|
56
|
+
clientCredentials?: Omit<IFlow, "authorizationUrl">;
|
|
57
|
+
}
|
|
58
|
+
export interface IFlow {
|
|
59
|
+
authorizationUrl: string;
|
|
60
|
+
tokenUrl: string;
|
|
61
|
+
refreshUrl: string;
|
|
62
|
+
scopes?: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
export interface ITypeTuple {
|
|
4
|
-
type: ts.Type;
|
|
5
|
-
typeName: string;
|
|
6
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
export interface ITypeTuple {
|
|
4
|
+
type: ts.Type;
|
|
5
|
+
typeName: string;
|
|
6
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
-
|
|
3
|
-
export namespace MethodType {
|
|
4
|
-
export const VALUES: MethodType[] = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
5
|
-
}
|
|
1
|
+
export type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
+
|
|
3
|
+
export namespace MethodType {
|
|
4
|
+
export const VALUES: MethodType[] = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
5
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ParamCategory = "param" | "query" | "body" | "headers";
|
|
1
|
+
export type ParamCategory = "param" | "query" | "body" | "headers";
|