@nestia/sdk 3.10.0 → 3.11.0-dev.20240813
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/NestiaSdkApplication.d.ts +1 -3
- package/lib/NestiaSdkApplication.js +138 -136
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.d.ts +2 -2
- package/lib/analyses/ConfigAnalyzer.js +39 -80
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ExceptionAnalyzer.d.ts +0 -16
- package/lib/analyses/ExceptionAnalyzer.js +142 -105
- package/lib/analyses/ExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/GenericAnalyzer.d.ts +1 -2
- package/lib/analyses/GenericAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +6 -11
- package/lib/analyses/ImportAnalyzer.js +70 -42
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +7 -1
- package/lib/analyses/ReflectControllerAnalyzer.js +28 -99
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +6 -2
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +72 -152
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +15 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +215 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +15 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +81 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -0
- package/lib/analyses/ReflectMetadataAnalyzer.d.ts +1 -3
- package/lib/analyses/ReflectMetadataAnalyzer.js +0 -4
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +6 -2
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +72 -48
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +15 -0
- package/lib/analyses/TypedHttpRouteAnalyzer.js +111 -0
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +10 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +9 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -0
- package/lib/decorators/OperationMetadata.d.ts +2 -0
- package/lib/decorators/OperationMetadata.js +10 -0
- package/lib/decorators/OperationMetadata.js.map +1 -0
- package/lib/executable/internal/NestiaConfigLoader.d.ts +1 -1
- package/lib/executable/internal/NestiaConfigLoader.js +34 -3
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/generates/CloneGenerator.d.ts +0 -5
- package/lib/generates/CloneGenerator.js +60 -60
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.d.ts +2 -3
- package/lib/generates/E2eGenerator.js +9 -8
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/OpenAiGenerator.d.ts +2 -4
- package/lib/generates/OpenAiGenerator.js +13 -3
- package/lib/generates/OpenAiGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +4 -4
- package/lib/generates/SdkGenerator.js +63 -73
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +6 -18
- package/lib/generates/SwaggerGenerator.js +60 -235
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +5 -9
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +6 -4
- package/lib/generates/internal/SdkAliasCollection.js +33 -31
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +4 -1
- package/lib/generates/internal/SdkDistributionComposer.js +6 -6
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +2 -4
- package/lib/generates/internal/SdkFileProgrammer.js +6 -6
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +0 -12
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +142 -97
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +37 -59
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +31 -48
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +7 -3
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +7 -13
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +1 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +11 -16
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +1 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +7 -10
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +23 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +12 -0
- package/lib/generates/internal/SwaggerOperationComposer.js +68 -0
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +18 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +99 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +9 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +91 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -0
- package/lib/structures/INestiaProject.d.ts +5 -5
- package/lib/structures/INestiaSdkInput.d.ts +20 -0
- package/lib/structures/{ISwaggerError.js → INestiaSdkInput.js} +1 -1
- package/lib/structures/INestiaSdkInput.js.map +1 -0
- package/lib/structures/IReflectApplication.d.ts +6 -0
- package/lib/structures/IReflectApplication.js +3 -0
- package/lib/structures/IReflectApplication.js.map +1 -0
- package/lib/structures/IReflectController.d.ts +3 -5
- package/lib/structures/IReflectHttpOperation.d.ts +13 -65
- package/lib/structures/IReflectHttpOperationException.d.ts +14 -0
- package/lib/structures/IReflectHttpOperationException.js +3 -0
- package/lib/structures/IReflectHttpOperationException.js.map +1 -0
- package/lib/structures/IReflectHttpOperationParameter.d.ts +35 -0
- package/lib/structures/IReflectHttpOperationParameter.js +3 -0
- package/lib/structures/IReflectHttpOperationParameter.js.map +1 -0
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +15 -0
- package/lib/structures/IReflectHttpOperationSuccess.js +3 -0
- package/lib/structures/IReflectHttpOperationSuccess.js.map +1 -0
- package/lib/structures/IReflectOperationError.d.ts +16 -0
- package/lib/structures/IReflectOperationError.js +23 -0
- package/lib/structures/IReflectOperationError.js.map +1 -0
- package/lib/structures/IReflectType.d.ts +4 -0
- package/lib/structures/{IErrorReport.js → IReflectType.js} +1 -1
- package/lib/structures/IReflectType.js.map +1 -0
- package/lib/structures/IReflectTypeImport.d.ts +4 -0
- package/lib/structures/{ISwaggerLazySchema.js → IReflectTypeImport.js} +1 -1
- package/lib/structures/IReflectTypeImport.js.map +1 -0
- package/lib/structures/IReflectWebSocketOperation.d.ts +8 -9
- package/lib/structures/IReflectWebSocketOperationParameter.d.ts +23 -0
- package/lib/structures/IReflectWebSocketOperationParameter.js +3 -0
- package/lib/structures/IReflectWebSocketOperationParameter.js.map +1 -0
- package/lib/structures/ITypedApplication.d.ts +7 -0
- package/lib/structures/{INormalizedInput.js → ITypedApplication.js} +1 -1
- package/lib/structures/ITypedApplication.js.map +1 -0
- package/lib/structures/ITypedHttpRoute.d.ts +14 -42
- package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteException.js +3 -0
- package/lib/structures/ITypedHttpRouteException.js.map +1 -0
- package/lib/structures/ITypedHttpRouteParameter.d.ts +31 -0
- package/lib/structures/ITypedHttpRouteParameter.js +3 -0
- package/lib/structures/ITypedHttpRouteParameter.js.map +1 -0
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +19 -0
- package/lib/structures/{ISwaggerLazyProperty.js → ITypedHttpRouteSuccess.js} +1 -1
- package/lib/structures/ITypedHttpRouteSuccess.js.map +1 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +8 -44
- package/lib/structures/ITypedWebSocketRouteParameter.d.ts +2 -0
- package/lib/structures/ITypedWebSocketRouteParameter.js +3 -0
- package/lib/structures/ITypedWebSocketRouteParameter.js.map +1 -0
- package/lib/transform.d.ts +3 -0
- package/lib/transform.js +8 -0
- package/lib/transform.js.map +1 -0
- package/lib/transformers/IOperationMetadata.d.ts +36 -0
- package/lib/transformers/IOperationMetadata.js +3 -0
- package/lib/transformers/IOperationMetadata.js.map +1 -0
- package/lib/transformers/ISdkTransformerContext.d.ts +7 -0
- package/lib/transformers/ISdkTransformerContext.js +3 -0
- package/lib/transformers/ISdkTransformerContext.js.map +1 -0
- package/lib/transformers/SdkMetadataProgrammer.d.ts +11 -0
- package/lib/transformers/SdkMetadataProgrammer.js +159 -0
- package/lib/transformers/SdkMetadataProgrammer.js.map +1 -0
- package/lib/transformers/SdkTransformer.d.ts +4 -0
- package/lib/transformers/SdkTransformer.js +88 -0
- package/lib/transformers/SdkTransformer.js.map +1 -0
- package/lib/transformers/TextPlainValidator.d.ts +4 -0
- package/lib/transformers/TextPlainValidator.js +19 -0
- package/lib/transformers/TextPlainValidator.js.map +1 -0
- package/lib/utils/StringUtil.d.ts +1 -0
- package/lib/utils/StringUtil.js +1 -0
- package/lib/utils/StringUtil.js.map +1 -1
- package/package.json +8 -8
- package/src/NestiaSdkApplication.ts +173 -160
- package/src/analyses/ConfigAnalyzer.ts +50 -98
- package/src/analyses/ExceptionAnalyzer.ts +142 -142
- package/src/analyses/GenericAnalyzer.ts +3 -5
- package/src/analyses/ImportAnalyzer.ts +130 -115
- package/src/analyses/ReflectControllerAnalyzer.ts +63 -115
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +142 -278
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +319 -0
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +117 -0
- package/src/analyses/ReflectMetadataAnalyzer.ts +1 -18
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +143 -78
- package/src/analyses/TypedHttpRouteAnalyzer.ts +178 -0
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +18 -0
- package/src/decorators/OperationMetadata.ts +15 -0
- package/src/executable/internal/NestiaConfigLoader.ts +18 -3
- package/src/executable/internal/NestiaSdkCommand.ts +1 -4
- package/src/generates/CloneGenerator.ts +60 -59
- package/src/generates/E2eGenerator.ts +20 -21
- package/src/generates/OpenAiGenerator.ts +44 -45
- package/src/generates/SdkGenerator.ts +97 -125
- package/src/generates/SwaggerGenerator.ts +114 -416
- package/src/generates/internal/E2eFileProgrammer.ts +5 -14
- package/src/generates/internal/SdkAliasCollection.ts +33 -41
- package/src/generates/internal/SdkDistributionComposer.ts +9 -6
- package/src/generates/internal/SdkFileProgrammer.ts +11 -14
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +142 -142
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +20 -47
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +245 -275
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +7 -7
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +11 -23
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +197 -233
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +5 -15
- package/src/generates/internal/{SwaggerDescriptionGenerator.ts → SwaggerDescriptionComposer.ts} +25 -5
- package/src/generates/internal/SwaggerOperationComposer.ts +90 -0
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +173 -0
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +110 -0
- package/src/structures/INestiaProject.ts +5 -5
- package/src/structures/INestiaSdkInput.ts +25 -0
- package/src/structures/IReflectApplication.ts +8 -0
- package/src/structures/IReflectController.ts +3 -5
- package/src/structures/IReflectHttpOperation.ts +14 -76
- package/src/structures/IReflectHttpOperationException.ts +19 -0
- package/src/structures/IReflectHttpOperationParameter.ts +81 -0
- package/src/structures/IReflectHttpOperationSuccess.ts +22 -0
- package/src/structures/IReflectOperationError.ts +26 -0
- package/src/structures/IReflectType.ts +4 -0
- package/src/structures/IReflectTypeImport.ts +4 -0
- package/src/structures/IReflectWebSocketOperation.ts +9 -9
- package/src/structures/IReflectWebSocketOperationParameter.ts +38 -0
- package/src/structures/ITypedApplication.ts +8 -0
- package/src/structures/ITypedHttpRoute.ts +15 -45
- package/src/structures/ITypedHttpRouteException.ts +15 -0
- package/src/structures/ITypedHttpRouteParameter.ts +41 -0
- package/src/structures/ITypedHttpRouteSuccess.ts +22 -0
- package/src/structures/ITypedWebSocketRoute.ts +8 -56
- package/src/structures/ITypedWebSocketRouteParameter.ts +3 -0
- package/src/transform.ts +9 -0
- package/src/transformers/IOperationMetadata.ts +38 -0
- package/src/transformers/ISdkTransformerContext.ts +8 -0
- package/src/transformers/SdkMetadataProgrammer.ts +227 -0
- package/src/transformers/SdkTransformer.ts +168 -0
- package/src/transformers/TextPlainValidator.ts +17 -0
- package/src/utils/StringUtil.ts +3 -0
- package/lib/analyses/TypedControllerAnalyzer.d.ts +0 -8
- package/lib/analyses/TypedControllerAnalyzer.js +0 -77
- package/lib/analyses/TypedControllerAnalyzer.js.map +0 -1
- package/lib/analyses/TypedHttpOperationAnalyzer.d.ts +0 -15
- package/lib/analyses/TypedHttpOperationAnalyzer.js +0 -263
- package/lib/analyses/TypedHttpOperationAnalyzer.js.map +0 -1
- package/lib/analyses/TypedWebSocketOperationAnalyzer.d.ts +0 -15
- package/lib/analyses/TypedWebSocketOperationAnalyzer.js +0 -226
- package/lib/analyses/TypedWebSocketOperationAnalyzer.js.map +0 -1
- package/lib/generates/internal/SwaggerDescriptionGenerator.d.ts +0 -14
- package/lib/generates/internal/SwaggerDescriptionGenerator.js +0 -33
- package/lib/generates/internal/SwaggerDescriptionGenerator.js.map +0 -1
- package/lib/generates/internal/SwaggerSchemaGenerator.d.ts +0 -21
- package/lib/generates/internal/SwaggerSchemaGenerator.js +0 -289
- package/lib/generates/internal/SwaggerSchemaGenerator.js.map +0 -1
- package/lib/generates/internal/SwaggerSchemaValidator.d.ts +0 -7
- package/lib/generates/internal/SwaggerSchemaValidator.js +0 -191
- package/lib/generates/internal/SwaggerSchemaValidator.js.map +0 -1
- package/lib/structures/IErrorReport.d.ts +0 -6
- package/lib/structures/IErrorReport.js.map +0 -1
- package/lib/structures/INormalizedInput.d.ts +0 -19
- package/lib/structures/INormalizedInput.js.map +0 -1
- package/lib/structures/ISwaggerError.d.ts +0 -6
- package/lib/structures/ISwaggerError.js.map +0 -1
- package/lib/structures/ISwaggerLazyProperty.d.ts +0 -6
- package/lib/structures/ISwaggerLazyProperty.js.map +0 -1
- package/lib/structures/ISwaggerLazySchema.d.ts +0 -6
- package/lib/structures/ISwaggerLazySchema.js.map +0 -1
- package/lib/structures/ITypeTuple.d.ts +0 -5
- package/lib/structures/ITypeTuple.js +0 -3
- package/lib/structures/ITypeTuple.js.map +0 -1
- package/src/analyses/TypedControllerAnalyzer.ts +0 -92
- package/src/analyses/TypedHttpOperationAnalyzer.ts +0 -365
- package/src/analyses/TypedWebSocketOperationAnalyzer.ts +0 -375
- package/src/generates/internal/SwaggerSchemaGenerator.ts +0 -473
- package/src/generates/internal/SwaggerSchemaValidator.ts +0 -206
- package/src/structures/IErrorReport.ts +0 -6
- package/src/structures/INormalizedInput.ts +0 -20
- package/src/structures/ISwaggerError.ts +0 -8
- package/src/structures/ISwaggerLazyProperty.ts +0 -7
- package/src/structures/ISwaggerLazySchema.ts +0 -7
- package/src/structures/ITypeTuple.ts +0 -6
|
@@ -2,24 +2,22 @@ import ts from "typescript";
|
|
|
2
2
|
import { IJsDocTagInfo } from "typia";
|
|
3
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
4
4
|
|
|
5
|
-
import { INestiaProject } from "../../structures/INestiaProject";
|
|
6
5
|
import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
|
|
7
6
|
import { FilePrinter } from "./FilePrinter";
|
|
8
7
|
import { ImportDictionary } from "./ImportDictionary";
|
|
8
|
+
import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
9
9
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
10
|
-
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
11
10
|
import { SdkWebSocketNamespaceProgrammer } from "./SdkWebSocketNamespaceProgrammer";
|
|
12
11
|
|
|
13
12
|
export namespace SdkWebSocketRouteProgrammer {
|
|
14
13
|
export const write =
|
|
15
|
-
(project: INestiaProject) =>
|
|
16
14
|
(importer: ImportDictionary) =>
|
|
17
15
|
(route: ITypedWebSocketRoute): ts.Statement[] => [
|
|
18
16
|
FilePrinter.description(
|
|
19
|
-
writeFunction(
|
|
17
|
+
writeFunction(importer)(route),
|
|
20
18
|
writeDescription(route),
|
|
21
19
|
),
|
|
22
|
-
SdkWebSocketNamespaceProgrammer.write(
|
|
20
|
+
SdkWebSocketNamespaceProgrammer.write(importer)(route),
|
|
23
21
|
];
|
|
24
22
|
|
|
25
23
|
const writeDescription = (route: ITypedWebSocketRoute): string => {
|
|
@@ -48,7 +46,7 @@ export namespace SdkWebSocketRouteProgrammer {
|
|
|
48
46
|
// POSTFIX
|
|
49
47
|
if (!!comments.length) comments.push("");
|
|
50
48
|
comments.push(
|
|
51
|
-
`@controller ${route.controller.name}.${route.name}`,
|
|
49
|
+
`@controller ${route.controller.class.name}.${route.name}`,
|
|
52
50
|
`@path ${route.path}`,
|
|
53
51
|
`@nestia Generated by Nestia - https://github.com/samchon/nestia`,
|
|
54
52
|
);
|
|
@@ -56,7 +54,6 @@ export namespace SdkWebSocketRouteProgrammer {
|
|
|
56
54
|
};
|
|
57
55
|
|
|
58
56
|
const writeFunction =
|
|
59
|
-
(project: INestiaProject) =>
|
|
60
57
|
(importer: ImportDictionary) =>
|
|
61
58
|
(route: ITypedWebSocketRoute): ts.FunctionDeclaration =>
|
|
62
59
|
ts.factory.createFunctionDeclaration(
|
|
@@ -81,7 +78,7 @@ export namespace SdkWebSocketRouteProgrammer {
|
|
|
81
78
|
IdentifierFactory.parameter(
|
|
82
79
|
p.name,
|
|
83
80
|
p.category === "param"
|
|
84
|
-
?
|
|
81
|
+
? SdkAliasCollection.name(p.type)
|
|
85
82
|
: ts.factory.createTypeReferenceNode(`${route.name}.Query`),
|
|
86
83
|
),
|
|
87
84
|
),
|
|
@@ -268,10 +265,3 @@ const joinPath = (caller: ts.Expression) =>
|
|
|
268
265
|
ts.factory.createTemplateTail("", ""),
|
|
269
266
|
),
|
|
270
267
|
]);
|
|
271
|
-
const getPathParameterType =
|
|
272
|
-
(project: INestiaProject) =>
|
|
273
|
-
(importer: ImportDictionary) =>
|
|
274
|
-
(p: ITypedWebSocketRoute.IPathParameter) =>
|
|
275
|
-
p.metadata
|
|
276
|
-
? SdkTypeProgrammer.write(project)(importer)(p.metadata)
|
|
277
|
-
: ts.factory.createTypeReferenceNode(p.typeName);
|
package/src/generates/internal/{SwaggerDescriptionGenerator.ts → SwaggerDescriptionComposer.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IJsDocTagInfo } from "typia";
|
|
2
2
|
|
|
3
|
-
export namespace
|
|
4
|
-
export const
|
|
5
|
-
description
|
|
3
|
+
export namespace SwaggerDescriptionComposer {
|
|
4
|
+
export const compose = <Kind extends "summary" | "title">(props: {
|
|
5
|
+
description: string | null;
|
|
6
6
|
jsDocTags: IJsDocTagInfo[];
|
|
7
7
|
kind: Kind;
|
|
8
8
|
}): Kind extends "summary"
|
|
@@ -14,7 +14,7 @@ export namespace SwaggerDescriptionGenerator {
|
|
|
14
14
|
name: props.kind,
|
|
15
15
|
});
|
|
16
16
|
if (explicit?.length) return explicit;
|
|
17
|
-
else if (props.description
|
|
17
|
+
else if (!props.description?.length) return undefined;
|
|
18
18
|
|
|
19
19
|
const index: number = props.description.indexOf("\n");
|
|
20
20
|
const top: string = (
|
|
@@ -28,7 +28,27 @@ export namespace SwaggerDescriptionGenerator {
|
|
|
28
28
|
} as any;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
export const descriptionFromJsDocTag = (props: {
|
|
32
|
+
jsDocTags: IJsDocTagInfo[];
|
|
33
|
+
tag: string;
|
|
34
|
+
parameter?: string;
|
|
35
|
+
}): string | undefined => {
|
|
36
|
+
const parametric: (elem: IJsDocTagInfo) => boolean = props.parameter
|
|
37
|
+
? (tag) =>
|
|
38
|
+
tag.text!.find(
|
|
39
|
+
(elem) =>
|
|
40
|
+
elem.kind === "parameterName" && elem.text === props.parameter,
|
|
41
|
+
) !== undefined
|
|
42
|
+
: () => true;
|
|
43
|
+
const tag: IJsDocTagInfo | undefined = props.jsDocTags.find(
|
|
44
|
+
(tag) => tag.name === props.tag && tag.text && parametric(tag),
|
|
45
|
+
);
|
|
46
|
+
return tag && tag.text
|
|
47
|
+
? tag.text.find((elem) => elem.kind === "text")?.text
|
|
48
|
+
: undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const getJsDocTexts = (props: {
|
|
32
52
|
jsDocTags: IJsDocTagInfo[];
|
|
33
53
|
name: string;
|
|
34
54
|
}): string[] =>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
3
|
+
|
|
4
|
+
import { INestiaConfig } from "../../INestiaConfig";
|
|
5
|
+
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
6
|
+
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
7
|
+
import { SwaggerDescriptionComposer } from "./SwaggerDescriptionComposer";
|
|
8
|
+
import { SwaggerOperationParameterComposer } from "./SwaggerOperationParameterComposer";
|
|
9
|
+
import { SwaggerOperationResponseComposer } from "./SwaggerOperationResponseComposer";
|
|
10
|
+
|
|
11
|
+
export namespace SwaggerOperationComposer {
|
|
12
|
+
export const compose = (props: {
|
|
13
|
+
config: INestiaConfig.ISwaggerConfig;
|
|
14
|
+
document: OpenApi.IDocument;
|
|
15
|
+
schema: (metadata: Metadata) => OpenApi.IJsonSchema | undefined;
|
|
16
|
+
route: ITypedHttpRoute;
|
|
17
|
+
}): OpenApi.IOperation => {
|
|
18
|
+
// FIND REQUEST BODY
|
|
19
|
+
const body: ITypedHttpRouteParameter.IBody | undefined =
|
|
20
|
+
props.route.parameters.find((param) => param.category === "body");
|
|
21
|
+
|
|
22
|
+
// COMPOSE TAGS
|
|
23
|
+
const tags: Set<string> = new Set([
|
|
24
|
+
...props.route.tags,
|
|
25
|
+
...SwaggerDescriptionComposer.getJsDocTexts({
|
|
26
|
+
jsDocTags: props.route.jsDocTags,
|
|
27
|
+
name: "tag",
|
|
28
|
+
}).map((t) => t.split(" ")[0]),
|
|
29
|
+
]);
|
|
30
|
+
if (tags.size) {
|
|
31
|
+
props.document.tags ??= [];
|
|
32
|
+
for (const t of tags)
|
|
33
|
+
if (props.document.tags.find((elem) => elem.name === t) === undefined)
|
|
34
|
+
props.document.tags.push({ name: t });
|
|
35
|
+
for (const texts of SwaggerDescriptionComposer.getJsDocTexts({
|
|
36
|
+
jsDocTags: props.route.jsDocTags,
|
|
37
|
+
name: "tag",
|
|
38
|
+
})) {
|
|
39
|
+
const [name, ...description] = texts.split(" ");
|
|
40
|
+
if (description.length)
|
|
41
|
+
props.document.tags.find(
|
|
42
|
+
(elem) => elem.name === name,
|
|
43
|
+
)!.description ??= description.join(" ");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// FINALIZE
|
|
48
|
+
return {
|
|
49
|
+
...SwaggerDescriptionComposer.compose({
|
|
50
|
+
description: props.route.description,
|
|
51
|
+
jsDocTags: props.route.jsDocTags,
|
|
52
|
+
kind: "summary",
|
|
53
|
+
}),
|
|
54
|
+
deprecated: props.route.jsDocTags.some((tag) => tag.name === "deprecated")
|
|
55
|
+
? true
|
|
56
|
+
: undefined,
|
|
57
|
+
tags: Array.from(tags),
|
|
58
|
+
operationId:
|
|
59
|
+
props.route.operationId ??
|
|
60
|
+
props.config.operationId?.({
|
|
61
|
+
class: props.route.controller.class.name,
|
|
62
|
+
function: props.route.name,
|
|
63
|
+
method: props.route.method as "GET",
|
|
64
|
+
path: props.route.path,
|
|
65
|
+
}),
|
|
66
|
+
parameters: props.route.parameters
|
|
67
|
+
.map((p) =>
|
|
68
|
+
SwaggerOperationParameterComposer.compose({
|
|
69
|
+
config: props.config,
|
|
70
|
+
document: props.document,
|
|
71
|
+
schema: props.schema(p.metadata)!,
|
|
72
|
+
parameter: p,
|
|
73
|
+
jsDocTags: props.route.jsDocTags,
|
|
74
|
+
}),
|
|
75
|
+
)
|
|
76
|
+
.flat(),
|
|
77
|
+
requestBody: body
|
|
78
|
+
? SwaggerOperationParameterComposer.body({
|
|
79
|
+
schema: props.schema(body.metadata)!,
|
|
80
|
+
jsDocTags: props.route.jsDocTags,
|
|
81
|
+
parameter: body,
|
|
82
|
+
})
|
|
83
|
+
: undefined,
|
|
84
|
+
responses: SwaggerOperationResponseComposer.compose({
|
|
85
|
+
schema: props.schema,
|
|
86
|
+
route: props.route,
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
import { VariadicSingleton } from "tstl";
|
|
3
|
+
import { IJsDocTagInfo, IJsonApplication } from "typia";
|
|
4
|
+
import { JsonApplicationProgrammer } from "typia/lib/programmers/json/JsonApplicationProgrammer";
|
|
5
|
+
|
|
6
|
+
import { INestiaConfig } from "../../INestiaConfig";
|
|
7
|
+
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
8
|
+
import { SwaggerDescriptionComposer } from "./SwaggerDescriptionComposer";
|
|
9
|
+
|
|
10
|
+
export namespace SwaggerOperationParameterComposer {
|
|
11
|
+
export interface IProps<Parameter extends ITypedHttpRouteParameter> {
|
|
12
|
+
config: INestiaConfig.ISwaggerConfig;
|
|
13
|
+
document: OpenApi.IDocument;
|
|
14
|
+
schema: OpenApi.IJsonSchema;
|
|
15
|
+
jsDocTags: IJsDocTagInfo[];
|
|
16
|
+
parameter: Parameter;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const compose = (
|
|
20
|
+
props: IProps<ITypedHttpRouteParameter>,
|
|
21
|
+
): OpenApi.IOperation.IParameter[] =>
|
|
22
|
+
props.parameter.category === "body"
|
|
23
|
+
? []
|
|
24
|
+
: props.parameter.category === "param"
|
|
25
|
+
? [path({ ...props, parameter: props.parameter })]
|
|
26
|
+
: props.parameter.category === "query"
|
|
27
|
+
? query({ ...props, parameter: props.parameter })
|
|
28
|
+
: header({ ...props, parameter: props.parameter });
|
|
29
|
+
|
|
30
|
+
export const body = (
|
|
31
|
+
props: Omit<IProps<ITypedHttpRouteParameter.IBody>, "config" | "document">,
|
|
32
|
+
): OpenApi.IOperation.IRequestBody => {
|
|
33
|
+
const description: string | undefined =
|
|
34
|
+
SwaggerDescriptionComposer.descriptionFromJsDocTag({
|
|
35
|
+
jsDocTags: props.jsDocTags,
|
|
36
|
+
tag: "param",
|
|
37
|
+
parameter: props.parameter.name,
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
description: props.parameter.encrypted
|
|
41
|
+
? `${warning.get(!!description)}${description ?? ""}`
|
|
42
|
+
: description,
|
|
43
|
+
content: {
|
|
44
|
+
[props.parameter.contentType]: {
|
|
45
|
+
schema: props.schema,
|
|
46
|
+
example: props.parameter.example,
|
|
47
|
+
examples: props.parameter.examples,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: props.parameter.metadata.isRequired(),
|
|
51
|
+
...(props.parameter.encrypted ? { "x-nestia-encrypted": true } : {}),
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const path = (
|
|
56
|
+
props: Omit<IProps<ITypedHttpRouteParameter.IParam>, "config" | "document">,
|
|
57
|
+
): OpenApi.IOperation.IParameter => ({
|
|
58
|
+
name: props.parameter.field,
|
|
59
|
+
in: "path",
|
|
60
|
+
schema: props.schema,
|
|
61
|
+
required: props.parameter.metadata.isRequired(),
|
|
62
|
+
...SwaggerDescriptionComposer.compose({
|
|
63
|
+
description:
|
|
64
|
+
props.parameter.description ??
|
|
65
|
+
props.parameter.jsDocTags.find((tag) => tag.name === "description")
|
|
66
|
+
?.text?.[0].text ??
|
|
67
|
+
props.jsDocTags
|
|
68
|
+
.find(
|
|
69
|
+
(tag) =>
|
|
70
|
+
tag.name === "param" &&
|
|
71
|
+
tag.text?.[0].text === props.parameter.name,
|
|
72
|
+
)
|
|
73
|
+
?.text?.map((e) => e.text)
|
|
74
|
+
.join("")
|
|
75
|
+
.substring(props.parameter.name.length) ??
|
|
76
|
+
null,
|
|
77
|
+
jsDocTags: props.parameter.jsDocTags,
|
|
78
|
+
kind: "title",
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const query = (
|
|
83
|
+
props: IProps<ITypedHttpRouteParameter.IQuery>,
|
|
84
|
+
): OpenApi.IOperation.IParameter[] => decomposible(props);
|
|
85
|
+
|
|
86
|
+
export const header = (
|
|
87
|
+
props: IProps<ITypedHttpRouteParameter.IHeaders>,
|
|
88
|
+
): OpenApi.IOperation.IParameter[] => decomposible(props);
|
|
89
|
+
|
|
90
|
+
const decomposible = (
|
|
91
|
+
props: IProps<
|
|
92
|
+
ITypedHttpRouteParameter.IHeaders | ITypedHttpRouteParameter.IQuery
|
|
93
|
+
>,
|
|
94
|
+
): OpenApi.IOperation.IParameter[] => {
|
|
95
|
+
const param: OpenApi.IOperation.IParameter = {
|
|
96
|
+
name: props.parameter.field ?? props.parameter.name,
|
|
97
|
+
in: props.parameter.category === "query" ? "query" : "header",
|
|
98
|
+
schema: props.schema,
|
|
99
|
+
...SwaggerDescriptionComposer.compose({
|
|
100
|
+
description:
|
|
101
|
+
props.parameter.description ??
|
|
102
|
+
props.parameter.jsDocTags.find((tag) => tag.name === "description")
|
|
103
|
+
?.text?.[0].text ??
|
|
104
|
+
props.jsDocTags
|
|
105
|
+
.find(
|
|
106
|
+
(tag) =>
|
|
107
|
+
tag.name === "param" &&
|
|
108
|
+
tag.text?.[0].text === props.parameter.name,
|
|
109
|
+
)
|
|
110
|
+
?.text?.map((e) => e.text)
|
|
111
|
+
.join("")
|
|
112
|
+
.substring(props.parameter.name.length) ??
|
|
113
|
+
null,
|
|
114
|
+
jsDocTags: props.jsDocTags,
|
|
115
|
+
kind: "title",
|
|
116
|
+
}),
|
|
117
|
+
example: props.parameter.example,
|
|
118
|
+
examples: props.parameter.examples,
|
|
119
|
+
};
|
|
120
|
+
if (
|
|
121
|
+
props.config.decompose === false ||
|
|
122
|
+
props.parameter.metadata.objects.length === 0
|
|
123
|
+
)
|
|
124
|
+
return [param];
|
|
125
|
+
return props.parameter.metadata.objects[0].properties
|
|
126
|
+
.filter((p) =>
|
|
127
|
+
p.jsDocTags.every(
|
|
128
|
+
(tag) => tag.name !== "hidden" && tag.name !== "ignore",
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
.map((p) => {
|
|
132
|
+
const json: IJsonApplication = JsonApplicationProgrammer.write("3.1")([
|
|
133
|
+
p.value,
|
|
134
|
+
]) as IJsonApplication;
|
|
135
|
+
if (Object.keys(json.components.schemas ?? {}).length !== 0) {
|
|
136
|
+
props.document.components ??= {};
|
|
137
|
+
props.document.components.schemas ??= {};
|
|
138
|
+
Object.assign(
|
|
139
|
+
props.document.components.schemas,
|
|
140
|
+
json.components.schemas,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
name: p.key.constants[0].values[0].value as string,
|
|
145
|
+
in: props.parameter.category === "query" ? "query" : "header",
|
|
146
|
+
schema: json.schemas[0],
|
|
147
|
+
required: p.value.isRequired(),
|
|
148
|
+
...SwaggerDescriptionComposer.compose({
|
|
149
|
+
description: p.description ?? null,
|
|
150
|
+
jsDocTags: p.jsDocTags,
|
|
151
|
+
kind: "title",
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const warning = new VariadicSingleton((described: boolean): string => {
|
|
159
|
+
const summary = "Request body must be encrypted.";
|
|
160
|
+
const component =
|
|
161
|
+
"[EncryptedBody](https://github.com/samchon/@nestia/core#encryptedbody)";
|
|
162
|
+
const content: string[] = [
|
|
163
|
+
"## Warning",
|
|
164
|
+
"",
|
|
165
|
+
summary,
|
|
166
|
+
"",
|
|
167
|
+
`The request body data would be encrypted as "AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding", through the ${component} component.`,
|
|
168
|
+
"",
|
|
169
|
+
`Therefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.`,
|
|
170
|
+
];
|
|
171
|
+
if (described === true) content.push("", "----------------", "", "");
|
|
172
|
+
return content.join("\n");
|
|
173
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
import { VariadicSingleton } from "tstl";
|
|
3
|
+
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
4
|
+
|
|
5
|
+
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
6
|
+
import { StringUtil } from "../../utils/StringUtil";
|
|
7
|
+
import { SwaggerDescriptionComposer } from "./SwaggerDescriptionComposer";
|
|
8
|
+
|
|
9
|
+
export namespace SwaggerOperationResponseComposer {
|
|
10
|
+
export const compose = (props: {
|
|
11
|
+
schema: (metadata: Metadata) => OpenApi.IJsonSchema | undefined;
|
|
12
|
+
route: ITypedHttpRoute;
|
|
13
|
+
}): Record<string, OpenApi.IOperation.IResponse> => {
|
|
14
|
+
const output: Record<string, OpenApi.IOperation.IResponse> = {};
|
|
15
|
+
// FROM DECORATOR
|
|
16
|
+
for (const [status, error] of Object.entries(props.route.exceptions))
|
|
17
|
+
output[status] = {
|
|
18
|
+
description: error.description ?? undefined,
|
|
19
|
+
content: {
|
|
20
|
+
"application/json": {
|
|
21
|
+
schema: props.schema(error.metadata),
|
|
22
|
+
example: error.example,
|
|
23
|
+
examples: error.examples,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// FROM COMMENTS
|
|
29
|
+
for (const tag of props.route.jsDocTags) {
|
|
30
|
+
if (tag.name !== "throw" && tag.name !== "throws") continue;
|
|
31
|
+
const text: string | undefined = tag.text?.find(
|
|
32
|
+
(elem) => elem.kind === "text",
|
|
33
|
+
)?.text;
|
|
34
|
+
if (text === undefined) continue;
|
|
35
|
+
|
|
36
|
+
const elements: string[] = text.split(" ").map((str) => str.trim());
|
|
37
|
+
const status: string = elements[0];
|
|
38
|
+
if (
|
|
39
|
+
isNaN(Number(status)) &&
|
|
40
|
+
status !== "2XX" &&
|
|
41
|
+
status !== "3XX" &&
|
|
42
|
+
status !== "4XX" &&
|
|
43
|
+
status !== "5XX"
|
|
44
|
+
)
|
|
45
|
+
continue;
|
|
46
|
+
|
|
47
|
+
const description: string | undefined =
|
|
48
|
+
elements.length === 1 ? undefined : elements.slice(1).join(" ");
|
|
49
|
+
const oldbie = output[status];
|
|
50
|
+
if (description && oldbie !== undefined)
|
|
51
|
+
oldbie.description ??= description;
|
|
52
|
+
else if (oldbie === undefined)
|
|
53
|
+
output[status] = {
|
|
54
|
+
description,
|
|
55
|
+
content: {
|
|
56
|
+
"application/json": {
|
|
57
|
+
schema: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// SUCESS
|
|
64
|
+
const description: string | undefined =
|
|
65
|
+
SwaggerDescriptionComposer.descriptionFromJsDocTag({
|
|
66
|
+
jsDocTags: props.route.jsDocTags,
|
|
67
|
+
tag: "returns",
|
|
68
|
+
}) ??
|
|
69
|
+
SwaggerDescriptionComposer.descriptionFromJsDocTag({
|
|
70
|
+
jsDocTags: props.route.jsDocTags,
|
|
71
|
+
tag: "return",
|
|
72
|
+
});
|
|
73
|
+
output[
|
|
74
|
+
props.route.success.status ??
|
|
75
|
+
(props.route.method.toLowerCase() === "post" ? 201 : 200)
|
|
76
|
+
] = {
|
|
77
|
+
description: props.route.success.encrypted
|
|
78
|
+
? `${warning.get(!!description, props.route.method)}${description ?? ""}`
|
|
79
|
+
: description,
|
|
80
|
+
content: props.route.success.contentType
|
|
81
|
+
? {
|
|
82
|
+
[props.route.success.contentType]: {
|
|
83
|
+
schema: props.schema(props.route.success.metadata),
|
|
84
|
+
example: props.route.success.example,
|
|
85
|
+
examples: props.route.success.examples,
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
: undefined,
|
|
89
|
+
...(props.route.success.encrypted ? { "x-nestia-encrypted": true } : {}),
|
|
90
|
+
};
|
|
91
|
+
return output;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const warning = new VariadicSingleton((described: boolean, method: string) => {
|
|
96
|
+
const summary: string = "Response data have been encrypted.";
|
|
97
|
+
const component: string = `[EncryptedRoute.${StringUtil.capitalize(method)}](https://github.com/samchon/@nestia/core#encryptedroute)`;
|
|
98
|
+
|
|
99
|
+
const content: string[] = [
|
|
100
|
+
"## Warning",
|
|
101
|
+
"",
|
|
102
|
+
summary,
|
|
103
|
+
"",
|
|
104
|
+
`The response body data would be encrypted as "AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding", through the ${component} component.`,
|
|
105
|
+
"",
|
|
106
|
+
`Therefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.`,
|
|
107
|
+
];
|
|
108
|
+
if (described === true) content.push("", "----------------", "", "");
|
|
109
|
+
return content.join("\n");
|
|
110
|
+
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
3
|
import { INestiaConfig } from "../INestiaConfig";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { INestiaSdkInput } from "./INestiaSdkInput";
|
|
5
|
+
import { IReflectOperationError } from "./IReflectOperationError";
|
|
6
6
|
|
|
7
7
|
export interface INestiaProject {
|
|
8
8
|
config: INestiaConfig;
|
|
9
|
-
input:
|
|
9
|
+
input: INestiaSdkInput;
|
|
10
10
|
checker: ts.TypeChecker;
|
|
11
|
-
errors:
|
|
12
|
-
warnings:
|
|
11
|
+
errors: IReflectOperationError[];
|
|
12
|
+
warnings: IReflectOperationError[];
|
|
13
13
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INestApplication,
|
|
3
|
+
RouteInfo,
|
|
4
|
+
VersionValue,
|
|
5
|
+
} from "@nestjs/common/interfaces";
|
|
6
|
+
|
|
7
|
+
export interface INestiaSdkInput {
|
|
8
|
+
application: INestApplication;
|
|
9
|
+
controllers: INestiaSdkInput.IController[];
|
|
10
|
+
globalPrefix?: {
|
|
11
|
+
prefix: string;
|
|
12
|
+
exclude?: Array<string | RouteInfo>;
|
|
13
|
+
};
|
|
14
|
+
versioning?: {
|
|
15
|
+
prefix: string;
|
|
16
|
+
defaultVersion?: VersionValue;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export namespace INestiaSdkInput {
|
|
20
|
+
export interface IController {
|
|
21
|
+
class: Function;
|
|
22
|
+
location: string;
|
|
23
|
+
prefixes: string[];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -4,14 +4,12 @@ import { IReflectHttpOperation } from "./IReflectHttpOperation";
|
|
|
4
4
|
import { IReflectWebSocketOperation } from "./IReflectWebSocketOperation";
|
|
5
5
|
|
|
6
6
|
export interface IReflectController {
|
|
7
|
-
|
|
8
|
-
prototype: any;
|
|
9
|
-
file: string;
|
|
10
|
-
name: string;
|
|
7
|
+
class: Function;
|
|
11
8
|
prefixes: string[];
|
|
12
9
|
paths: string[];
|
|
10
|
+
file: string;
|
|
13
11
|
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
14
12
|
operations: Array<IReflectHttpOperation | IReflectWebSocketOperation>;
|
|
15
13
|
security: Record<string, string[]>[];
|
|
16
|
-
|
|
14
|
+
tags: string[];
|
|
17
15
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { VERSION_NEUTRAL } from "@nestjs/common/interfaces";
|
|
2
|
+
import { IJsDocTagInfo } from "typia";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { IReflectHttpOperationException } from "./IReflectHttpOperationException";
|
|
5
|
+
import { IReflectHttpOperationParameter } from "./IReflectHttpOperationParameter";
|
|
6
|
+
import { IReflectHttpOperationSuccess } from "./IReflectHttpOperationSuccess";
|
|
7
|
+
import { IReflectTypeImport } from "./IReflectTypeImport";
|
|
4
8
|
|
|
5
9
|
export interface IReflectHttpOperation {
|
|
6
10
|
protocol: "http";
|
|
@@ -9,82 +13,16 @@ export interface IReflectHttpOperation {
|
|
|
9
13
|
method: string;
|
|
10
14
|
paths: string[];
|
|
11
15
|
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
status?: number;
|
|
15
|
-
type?: string;
|
|
16
|
-
contentType: "application/json" | "text/plain";
|
|
17
|
-
security: Record<string, string[]>[];
|
|
16
|
+
parameters: IReflectHttpOperationParameter[];
|
|
17
|
+
success: IReflectHttpOperationSuccess;
|
|
18
18
|
exceptions: Record<
|
|
19
19
|
number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
20
|
-
|
|
20
|
+
IReflectHttpOperationException
|
|
21
21
|
>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| ICommonParameter
|
|
29
|
-
| IQueryParameter
|
|
30
|
-
| IHeadersParameter
|
|
31
|
-
| IBodyParameter
|
|
32
|
-
| IPathParameter;
|
|
33
|
-
export interface ICommonParameter {
|
|
34
|
-
custom: false;
|
|
35
|
-
category: ParamCategory;
|
|
36
|
-
index: number;
|
|
37
|
-
name: string;
|
|
38
|
-
field: string | undefined;
|
|
39
|
-
example?: any;
|
|
40
|
-
examples?: Record<string, any>;
|
|
41
|
-
}
|
|
42
|
-
export interface IHeadersParameter {
|
|
43
|
-
custom: true;
|
|
44
|
-
category: "headers";
|
|
45
|
-
index: number;
|
|
46
|
-
name: string;
|
|
47
|
-
field: string | undefined;
|
|
48
|
-
example?: any;
|
|
49
|
-
examples?: Record<string, any>;
|
|
50
|
-
}
|
|
51
|
-
export interface IQueryParameter {
|
|
52
|
-
custom: true;
|
|
53
|
-
category: "query";
|
|
54
|
-
index: number;
|
|
55
|
-
name: string;
|
|
56
|
-
field: string | undefined;
|
|
57
|
-
example?: any;
|
|
58
|
-
examples?: Record<string, any>;
|
|
59
|
-
}
|
|
60
|
-
export interface IBodyParameter {
|
|
61
|
-
custom: true;
|
|
62
|
-
category: "body";
|
|
63
|
-
index: number;
|
|
64
|
-
name: string;
|
|
65
|
-
field: string | undefined;
|
|
66
|
-
encrypted: boolean;
|
|
67
|
-
contentType:
|
|
68
|
-
| "application/json"
|
|
69
|
-
| "application/x-www-form-urlencoded"
|
|
70
|
-
| "multipart/form-data"
|
|
71
|
-
| "text/plain";
|
|
72
|
-
example?: any;
|
|
73
|
-
examples?: Record<string, any>;
|
|
74
|
-
}
|
|
75
|
-
export interface IPathParameter {
|
|
76
|
-
custom: true;
|
|
77
|
-
category: "param";
|
|
78
|
-
index: number;
|
|
79
|
-
name: string;
|
|
80
|
-
field: string | undefined;
|
|
81
|
-
example?: any;
|
|
82
|
-
examples?: Record<string, any>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface IException {
|
|
86
|
-
type: string;
|
|
87
|
-
status: number | "2XX" | "3XX" | "4XX" | "5XX";
|
|
88
|
-
description: string | undefined;
|
|
89
|
-
}
|
|
22
|
+
security: Record<string, string[]>[];
|
|
23
|
+
tags: string[];
|
|
24
|
+
imports: IReflectTypeImport[];
|
|
25
|
+
operationId: string | undefined;
|
|
26
|
+
description: string | null;
|
|
27
|
+
jsDocTags: IJsDocTagInfo[];
|
|
90
28
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
|
|
2
|
+
import { IMetadata } from "typia/lib/schemas/metadata/IMetadata";
|
|
3
|
+
import { IMetadataComponents } from "typia/lib/schemas/metadata/IMetadataComponents";
|
|
4
|
+
|
|
5
|
+
import { IReflectType } from "./IReflectType";
|
|
6
|
+
|
|
7
|
+
export interface IReflectHttpOperationException {
|
|
8
|
+
// BASIC PROPERTIES
|
|
9
|
+
status: number | "2XX" | "3XX" | "4XX" | "5XX";
|
|
10
|
+
description: string | null;
|
|
11
|
+
example: any;
|
|
12
|
+
examples: Record<string, any>;
|
|
13
|
+
|
|
14
|
+
// REFLECTED PROPERTIES
|
|
15
|
+
type: IReflectType;
|
|
16
|
+
metadata: IMetadata;
|
|
17
|
+
components: IMetadataComponents;
|
|
18
|
+
validate: MetadataFactory.Validator;
|
|
19
|
+
}
|