typia 3.4.4 → 3.4.6
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/README.md +5 -47
- package/lib/executable/internal/TypiaSetupWizard.js +8 -6
- package/lib/executable/internal/TypiaSetupWizard.js.map +1 -1
- package/package.json +1 -1
- package/src/executable/internal/TypiaSetupWizard.ts +148 -149
- package/src/executable/typia.ts +35 -35
- package/src/factories/MetadataTagFactory.ts +347 -347
- package/src/factories/internal/iterate_metadata.ts +81 -81
- package/src/factories/internal/iterate_metadata_native.ts +227 -227
- package/src/functional/$number.ts +19 -19
- package/src/index.ts +4 -4
- package/src/module.ts +1535 -1535
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/StringifyProgrammer.ts +746 -746
- package/src/programmers/internal/application_array.ts +45 -45
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_number.ts +76 -76
- package/src/programmers/internal/application_object.ts +103 -103
- package/src/programmers/internal/application_string.ts +49 -49
- package/src/schemas/IJsonComponents.ts +24 -24
- package/src/schemas/IJsonSchema.ts +92 -92
- package/src/transformers/CallExpressionTransformer.ts +124 -124
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +114 -114
- package/src/transformers/features/miscellaneous/CreateInstanceTransformer.ts +41 -41
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +55 -55
- package/src/transformers/features/parsers/AssertParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateIsParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/IsParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/ValidateParseTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +31 -31
- package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +32 -32
- package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/StringifyTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +38 -38
- package/src/transformers/features/validators/AssertTransformer.ts +43 -43
- package/src/transformers/features/validators/CreateAssertTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateIsTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateValidateTransformer.ts +35 -35
- package/src/transformers/features/validators/IsTransformer.ts +43 -43
- package/src/transformers/features/validators/ValidateTransformer.ts +43 -43
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { Metadata } from "../metadata/Metadata";
|
|
2
|
-
import { IJsonApplication } from "../schemas/IJsonApplication";
|
|
3
|
-
import { IJsonComponents } from "../schemas/IJsonComponents";
|
|
4
|
-
import { IJsonSchema } from "../schemas/IJsonSchema";
|
|
5
|
-
|
|
6
|
-
import { application_schema } from "./internal/application_schema";
|
|
7
|
-
|
|
8
|
-
export namespace ApplicationProgrammer {
|
|
9
|
-
export const AJV_PREFIX = "components#/schemas";
|
|
10
|
-
export const SWAGGER_PREFIX = "#/components/schemas";
|
|
11
|
-
|
|
12
|
-
export interface IOptions {
|
|
13
|
-
purpose: "swagger" | "ajv";
|
|
14
|
-
prefix: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export namespace IOptions {
|
|
21
|
-
export function complement(options?: Partial<IOptions>): IOptions {
|
|
22
|
-
const purpose: "swagger" | "ajv" = options?.purpose ?? "swagger";
|
|
23
|
-
return {
|
|
24
|
-
purpose,
|
|
25
|
-
prefix:
|
|
26
|
-
options?.prefix ||
|
|
27
|
-
(purpose === "swagger" ? SWAGGER_PREFIX : AJV_PREFIX),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function generate(
|
|
33
|
-
metadatas: Array<Metadata>,
|
|
34
|
-
options?: Partial<IOptions>,
|
|
35
|
-
): IJsonApplication {
|
|
36
|
-
const fullOptions: IOptions = IOptions.complement(options);
|
|
37
|
-
const components: IJsonComponents = {
|
|
38
|
-
schemas: {},
|
|
39
|
-
};
|
|
40
|
-
const generator = application_schema(fullOptions)(components)(true);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
schemas: metadatas.map((meta, i) => {
|
|
44
|
-
const schema: IJsonSchema | null = generator(meta, {});
|
|
45
|
-
if (schema === null)
|
|
46
|
-
throw new Error(
|
|
47
|
-
`Error on typia.application(): invalid type on argument - (${meta.getName()}, ${i})`,
|
|
48
|
-
);
|
|
49
|
-
return schema;
|
|
50
|
-
}),
|
|
51
|
-
components,
|
|
52
|
-
...fullOptions,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
import { Metadata } from "../metadata/Metadata";
|
|
2
|
+
import { IJsonApplication } from "../schemas/IJsonApplication";
|
|
3
|
+
import { IJsonComponents } from "../schemas/IJsonComponents";
|
|
4
|
+
import { IJsonSchema } from "../schemas/IJsonSchema";
|
|
5
|
+
|
|
6
|
+
import { application_schema } from "./internal/application_schema";
|
|
7
|
+
|
|
8
|
+
export namespace ApplicationProgrammer {
|
|
9
|
+
export const AJV_PREFIX = "components#/schemas";
|
|
10
|
+
export const SWAGGER_PREFIX = "#/components/schemas";
|
|
11
|
+
|
|
12
|
+
export interface IOptions {
|
|
13
|
+
purpose: "swagger" | "ajv";
|
|
14
|
+
prefix: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export namespace IOptions {
|
|
21
|
+
export function complement(options?: Partial<IOptions>): IOptions {
|
|
22
|
+
const purpose: "swagger" | "ajv" = options?.purpose ?? "swagger";
|
|
23
|
+
return {
|
|
24
|
+
purpose,
|
|
25
|
+
prefix:
|
|
26
|
+
options?.prefix ||
|
|
27
|
+
(purpose === "swagger" ? SWAGGER_PREFIX : AJV_PREFIX),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function generate(
|
|
33
|
+
metadatas: Array<Metadata>,
|
|
34
|
+
options?: Partial<IOptions>,
|
|
35
|
+
): IJsonApplication {
|
|
36
|
+
const fullOptions: IOptions = IOptions.complement(options);
|
|
37
|
+
const components: IJsonComponents = {
|
|
38
|
+
schemas: {},
|
|
39
|
+
};
|
|
40
|
+
const generator = application_schema(fullOptions)(components)(true);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
schemas: metadatas.map((meta, i) => {
|
|
44
|
+
const schema: IJsonSchema | null = generator(meta, {});
|
|
45
|
+
if (schema === null)
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Error on typia.application(): invalid type on argument - (${meta.getName()}, ${i})`,
|
|
48
|
+
);
|
|
49
|
+
return schema;
|
|
50
|
+
}),
|
|
51
|
+
components,
|
|
52
|
+
...fullOptions,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|