typia 3.5.0-dev.20221222 → 3.5.0-dev.20230107

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.
Files changed (150) hide show
  1. package/README.md +5 -2
  2. package/lib/executable/internal/TypiaSetupWizard.d.ts +6 -2
  3. package/lib/executable/internal/TypiaSetupWizard.js +23 -22
  4. package/lib/executable/internal/TypiaSetupWizard.js.map +1 -1
  5. package/lib/executable/typia.js +11 -10
  6. package/lib/executable/typia.js.map +1 -1
  7. package/lib/metadata/Metadata.js +32 -29
  8. package/lib/metadata/Metadata.js.map +1 -1
  9. package/lib/programmers/AssertProgrammer.js +1 -1
  10. package/lib/programmers/AssertProgrammer.js.map +1 -1
  11. package/lib/programmers/CheckerProgrammer.d.ts +1 -0
  12. package/lib/programmers/CheckerProgrammer.js +147 -138
  13. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  14. package/lib/programmers/ValidateProgrammer.js +1 -1
  15. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  16. package/lib/programmers/helpers/UnionExplorer.d.ts +23 -29
  17. package/lib/programmers/helpers/UnionExplorer.js +29 -41
  18. package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
  19. package/lib/programmers/internal/application_schema.js +2 -0
  20. package/lib/programmers/internal/application_schema.js.map +1 -1
  21. package/lib/programmers/internal/check_array.js +4 -32
  22. package/lib/programmers/internal/check_array.js.map +1 -1
  23. package/lib/programmers/internal/check_array_length.d.ts +1 -0
  24. package/lib/programmers/internal/check_array_length.js +47 -0
  25. package/lib/programmers/internal/check_array_length.js.map +1 -0
  26. package/lib/programmers/internal/check_union_array_like.d.ts +21 -0
  27. package/lib/programmers/internal/check_union_array_like.js +83 -0
  28. package/lib/programmers/internal/check_union_array_like.js.map +1 -0
  29. package/lib/programmers/internal/check_union_tuple.d.ts +1 -0
  30. package/lib/programmers/internal/check_union_tuple.js +11 -0
  31. package/lib/programmers/internal/check_union_tuple.js.map +1 -0
  32. package/package.json +4 -4
  33. package/src/IValidation.ts +21 -21
  34. package/src/Primitive.ts +82 -82
  35. package/src/TypeGuardError.ts +36 -36
  36. package/src/executable/internal/CommandParser.ts +15 -15
  37. package/src/executable/internal/TypiaSetupWizard.ts +30 -21
  38. package/src/executable/typia.ts +48 -46
  39. package/src/factories/CommentFactory.ts +10 -10
  40. package/src/factories/ExpressionFactory.ts +66 -66
  41. package/src/factories/IdentifierFactory.ts +72 -72
  42. package/src/factories/LiteralFactory.ts +44 -44
  43. package/src/factories/StatementFactory.ts +60 -60
  44. package/src/factories/TemplateFactory.ts +56 -56
  45. package/src/factories/TypeFactory.ts +101 -101
  46. package/src/factories/ValueFactory.ts +12 -12
  47. package/src/functional/$every.ts +11 -11
  48. package/src/functional/$guard.ts +35 -35
  49. package/src/functional/$is_email.ts +5 -5
  50. package/src/functional/$is_ipv4.ts +5 -5
  51. package/src/functional/$is_ipv6.ts +5 -5
  52. package/src/functional/$is_url.ts +5 -5
  53. package/src/functional/$is_uuid.ts +5 -5
  54. package/src/functional/$join.ts +50 -50
  55. package/src/functional/$report.ts +15 -15
  56. package/src/functional/$rest.ts +3 -3
  57. package/src/functional/$string.ts +37 -37
  58. package/src/functional/$tail.ts +6 -6
  59. package/src/index.ts +4 -4
  60. package/src/metadata/IJsDocTagInfo.ts +10 -10
  61. package/src/metadata/IMetadata.ts +25 -25
  62. package/src/metadata/IMetadataApplication.ts +7 -7
  63. package/src/metadata/IMetadataConstant.ts +16 -16
  64. package/src/metadata/IMetadataEntry.ts +6 -6
  65. package/src/metadata/IMetadataObject.ts +29 -29
  66. package/src/metadata/IMetadataProperty.ts +11 -11
  67. package/src/metadata/Metadata.ts +10 -7
  68. package/src/metadata/MetadataConstant.ts +3 -3
  69. package/src/metadata/MetadataObject.ts +131 -131
  70. package/src/metadata/MetadataProperty.ts +64 -64
  71. package/src/programmers/ApplicationProgrammer.ts +55 -55
  72. package/src/programmers/AssertProgrammer.ts +1 -1
  73. package/src/programmers/CheckerProgrammer.ts +252 -200
  74. package/src/programmers/FeatureProgrammer.ts +327 -327
  75. package/src/programmers/ValidateProgrammer.ts +1 -1
  76. package/src/programmers/helpers/AtomicPredicator.ts +15 -15
  77. package/src/programmers/helpers/FunctionImporeter.ts +31 -31
  78. package/src/programmers/helpers/IExpressionEntry.ts +10 -10
  79. package/src/programmers/helpers/StringifyJoinder.ts +111 -111
  80. package/src/programmers/helpers/StringifyPredicator.ts +18 -18
  81. package/src/programmers/helpers/UnionExplorer.ts +274 -437
  82. package/src/programmers/helpers/UnionPredicator.ts +81 -81
  83. package/src/programmers/internal/application_array.ts +45 -45
  84. package/src/programmers/internal/application_boolean.ts +17 -17
  85. package/src/programmers/internal/application_constant.ts +29 -29
  86. package/src/programmers/internal/application_default_string.ts +32 -32
  87. package/src/programmers/internal/application_native.ts +29 -29
  88. package/src/programmers/internal/application_number.ts +76 -76
  89. package/src/programmers/internal/application_object.ts +103 -103
  90. package/src/programmers/internal/application_schema.ts +5 -0
  91. package/src/programmers/internal/application_string.ts +49 -49
  92. package/src/programmers/internal/application_templates.ts +27 -27
  93. package/src/programmers/internal/application_tuple.ts +25 -25
  94. package/src/programmers/internal/check_array.ts +22 -44
  95. package/src/programmers/internal/check_array_length.ts +45 -0
  96. package/src/programmers/internal/check_dynamic_properties.ts +146 -146
  97. package/src/programmers/internal/check_everything.ts +25 -25
  98. package/src/programmers/internal/check_length.ts +46 -46
  99. package/src/programmers/internal/check_native.ts +9 -9
  100. package/src/programmers/internal/check_object.ts +42 -42
  101. package/src/programmers/internal/check_string.ts +24 -24
  102. package/src/programmers/internal/check_string_tags.ts +63 -63
  103. package/src/programmers/internal/check_template.ts +50 -50
  104. package/src/programmers/internal/check_union_array_like.ts +242 -0
  105. package/src/programmers/internal/check_union_tuple.ts +33 -0
  106. package/src/programmers/internal/decode_union_object.ts +73 -73
  107. package/src/programmers/internal/feature_object_entries.ts +49 -49
  108. package/src/programmers/internal/metadata_to_pattern.ts +31 -31
  109. package/src/programmers/internal/stringify_dynamic_properties.ts +164 -164
  110. package/src/programmers/internal/stringify_native.ts +8 -8
  111. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  112. package/src/programmers/internal/template_to_pattern.ts +15 -15
  113. package/src/schemas/IJsonApplication.ts +9 -9
  114. package/src/schemas/IJsonComponents.ts +24 -24
  115. package/src/transform.ts +20 -20
  116. package/src/transformers/ExpressionWithArgumentTransformer.ts +66 -66
  117. package/src/transformers/FileTransformer.ts +49 -49
  118. package/src/transformers/IProject.ts +11 -11
  119. package/src/transformers/NodeTransformer.ts +19 -19
  120. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +1 -0
  121. package/src/transformers/features/miscellaneous/MetadataTransformer.ts +55 -55
  122. package/src/transformers/features/parsers/AssertParseTransformer.ts +36 -36
  123. package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +32 -32
  124. package/src/transformers/features/parsers/CreateIsParseTransformer.ts +32 -32
  125. package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +32 -32
  126. package/src/transformers/features/parsers/IsParseTransformer.ts +36 -36
  127. package/src/transformers/features/parsers/ValidateParseTransformer.ts +36 -36
  128. package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +38 -38
  129. package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +32 -32
  130. package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +32 -32
  131. package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +31 -31
  132. package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +32 -32
  133. package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +38 -38
  134. package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +38 -38
  135. package/src/transformers/features/validators/AssertTransformer.ts +43 -43
  136. package/src/transformers/features/validators/CreateAssertTransformer.ts +35 -35
  137. package/src/transformers/features/validators/CreateIsTransformer.ts +35 -35
  138. package/src/transformers/features/validators/CreateValidateTransformer.ts +35 -35
  139. package/src/transformers/features/validators/IsTransformer.ts +43 -43
  140. package/src/transformers/features/validators/ValidateTransformer.ts +43 -43
  141. package/src/typings/Atomic.ts +17 -17
  142. package/src/typings/ClassProperties.ts +5 -5
  143. package/src/typings/OmitNever.ts +3 -3
  144. package/src/typings/SpecialFields.ts +3 -3
  145. package/src/typings/Writable.ts +11 -11
  146. package/src/utils/ArrayUtil.ts +49 -49
  147. package/src/utils/Escaper.ts +50 -50
  148. package/src/utils/MapUtil.ts +14 -14
  149. package/src/utils/PatternUtil.ts +30 -30
  150. package/src/utils/Singleton.ts +17 -17
@@ -315,7 +315,9 @@ export namespace Metadata {
315
315
  // TUPLES
316
316
  for (const xt of x.tuples)
317
317
  for (const yt of y.tuples)
318
- if (
318
+ if (xt.length === 0 || yt.length === 0)
319
+ return xt.length === 0 && yt.length === 0;
320
+ else if (
319
321
  xt
320
322
  .slice(0, Math.min(xt.length, yt.length))
321
323
  .some((xv, i) => intersects(xv, yt[i]!, deep))
@@ -371,6 +373,7 @@ export namespace Metadata {
371
373
  // TUPLES
372
374
  for (const yt of y.tuples)
373
375
  if (
376
+ yt.length !== 0 &&
374
377
  x.tuples.some(
375
378
  (xt) =>
376
379
  xt.length >= yt.length &&
@@ -447,6 +450,12 @@ function getName(metadata: Metadata): string {
447
450
  "`",
448
451
  );
449
452
 
453
+ // NATIVES
454
+ for (const native of metadata.natives) elements.push(native);
455
+ for (const set of metadata.sets) elements.push(`Set<${set.getName()}>`);
456
+ for (const map of metadata.maps)
457
+ elements.push(`Map<${map.key.getName()}, ${map.value.getName()}>`);
458
+
450
459
  // ARRAY
451
460
  if (metadata.rest !== null) elements.push(`...${metadata.rest.getName()}`);
452
461
  for (const tuple of metadata.tuples)
@@ -458,12 +467,6 @@ function getName(metadata: Metadata): string {
458
467
  for (const object of metadata.objects) elements.push(object.name);
459
468
  if (metadata.resolved !== null) elements.push(metadata.resolved.getName());
460
469
 
461
- // NATIVES
462
- for (const native of metadata.natives) elements.push(native);
463
- for (const set of metadata.sets) elements.push(`Set<${set.getName()}>`);
464
- for (const map of metadata.maps)
465
- elements.push(`Map<${map.key.getName()}, ${map.value.getName()}>`);
466
-
467
470
  // RETURNS
468
471
  if (elements.length === 0) return "unknown";
469
472
  else if (elements.length === 1) return elements[0]!;
@@ -1,3 +1,3 @@
1
- import { IMetadataConstant } from "./IMetadataConstant";
2
-
3
- export import MetadataConstant = IMetadataConstant;
1
+ import { IMetadataConstant } from "./IMetadataConstant";
2
+
3
+ export import MetadataConstant = IMetadataConstant;
@@ -1,131 +1,131 @@
1
- import { ClassProperties } from "../typings/ClassProperties";
2
-
3
- import { IJsDocTagInfo } from "./IJsDocTagInfo";
4
- import { IMetadataObject } from "./IMetadataObject";
5
- import { MetadataProperty } from "./MetadataProperty";
6
-
7
- export class MetadataObject {
8
- public readonly name: string;
9
- public readonly properties: Array<MetadataProperty>;
10
- public readonly description: string | undefined;
11
- public readonly jsDocTags: IJsDocTagInfo[];
12
-
13
- /**
14
- * @internal
15
- */
16
- public readonly index: number;
17
-
18
- /**
19
- * @internal
20
- */
21
- public validated: boolean;
22
-
23
- /**
24
- * @internal
25
- */
26
- public recursive: boolean;
27
-
28
- /**
29
- * @internal
30
- */
31
- public nullables: boolean[] = [];
32
-
33
- /* -----------------------------------------------------------
34
- CONSTRUCTORS
35
- ----------------------------------------------------------- */
36
- /**
37
- * @hidden
38
- */
39
- private constructor(props: ClassProperties<MetadataObject>) {
40
- this.name = props.name;
41
- this.properties = props.properties;
42
- this.description = props.description;
43
- this.jsDocTags = props.jsDocTags;
44
-
45
- this.index = props.index;
46
- this.validated = props.validated;
47
- this.recursive = false;
48
- this.nullables = [];
49
- }
50
-
51
- /**
52
- * @internal
53
- */
54
- public static create(props: ClassProperties<MetadataObject>) {
55
- return new MetadataObject(props);
56
- }
57
-
58
- /**
59
- * @internal
60
- */
61
- public static _From_without_properties(
62
- obj: IMetadataObject,
63
- ): MetadataObject {
64
- return this.create({
65
- name: obj.name,
66
- properties: [],
67
- description: obj.description,
68
- jsDocTags: obj.jsDocTags,
69
-
70
- index: obj.index,
71
- validated: obj.validated,
72
- recursive: obj.recursive,
73
- nullables: obj.nullables.slice(),
74
- });
75
- }
76
-
77
- /**
78
- * @internal
79
- */
80
- public _Is_simple(): boolean {
81
- return (
82
- this.properties.length < 4 &&
83
- this.properties.every(
84
- (property) =>
85
- property.key.isSoleLiteral() &&
86
- property.value.size() === 1 &&
87
- property.value.atomics.length === 1 &&
88
- property.value.nullable === false &&
89
- property.value.required === true,
90
- )
91
- );
92
- }
93
-
94
- public toJSON(): IMetadataObject {
95
- return {
96
- name: this.name,
97
- properties: this.properties.map((property) => property.toJSON()),
98
- description: this.description,
99
- jsDocTags: this.jsDocTags,
100
-
101
- index: this.index,
102
- validated: this.validated,
103
- recursive: this.recursive,
104
- nullables: this.nullables.slice(),
105
- };
106
- }
107
- }
108
-
109
- /**
110
- * @internal
111
- */
112
- export namespace MetadataObject {
113
- export function intersects(x: MetadataObject, y: MetadataObject): boolean {
114
- return x.properties.some(
115
- (prop) =>
116
- y.properties.find((oppo) => prop.key === oppo.key) !==
117
- undefined,
118
- );
119
- }
120
-
121
- export function covers(x: MetadataObject, y: MetadataObject): boolean {
122
- return (
123
- x.properties.length >= y.properties.length &&
124
- x.properties.every(
125
- (prop) =>
126
- y.properties.find((oppo) => prop.key === oppo.key) !==
127
- undefined,
128
- )
129
- );
130
- }
131
- }
1
+ import { ClassProperties } from "../typings/ClassProperties";
2
+
3
+ import { IJsDocTagInfo } from "./IJsDocTagInfo";
4
+ import { IMetadataObject } from "./IMetadataObject";
5
+ import { MetadataProperty } from "./MetadataProperty";
6
+
7
+ export class MetadataObject {
8
+ public readonly name: string;
9
+ public readonly properties: Array<MetadataProperty>;
10
+ public readonly description: string | undefined;
11
+ public readonly jsDocTags: IJsDocTagInfo[];
12
+
13
+ /**
14
+ * @internal
15
+ */
16
+ public readonly index: number;
17
+
18
+ /**
19
+ * @internal
20
+ */
21
+ public validated: boolean;
22
+
23
+ /**
24
+ * @internal
25
+ */
26
+ public recursive: boolean;
27
+
28
+ /**
29
+ * @internal
30
+ */
31
+ public nullables: boolean[] = [];
32
+
33
+ /* -----------------------------------------------------------
34
+ CONSTRUCTORS
35
+ ----------------------------------------------------------- */
36
+ /**
37
+ * @hidden
38
+ */
39
+ private constructor(props: ClassProperties<MetadataObject>) {
40
+ this.name = props.name;
41
+ this.properties = props.properties;
42
+ this.description = props.description;
43
+ this.jsDocTags = props.jsDocTags;
44
+
45
+ this.index = props.index;
46
+ this.validated = props.validated;
47
+ this.recursive = false;
48
+ this.nullables = [];
49
+ }
50
+
51
+ /**
52
+ * @internal
53
+ */
54
+ public static create(props: ClassProperties<MetadataObject>) {
55
+ return new MetadataObject(props);
56
+ }
57
+
58
+ /**
59
+ * @internal
60
+ */
61
+ public static _From_without_properties(
62
+ obj: IMetadataObject,
63
+ ): MetadataObject {
64
+ return this.create({
65
+ name: obj.name,
66
+ properties: [],
67
+ description: obj.description,
68
+ jsDocTags: obj.jsDocTags,
69
+
70
+ index: obj.index,
71
+ validated: obj.validated,
72
+ recursive: obj.recursive,
73
+ nullables: obj.nullables.slice(),
74
+ });
75
+ }
76
+
77
+ /**
78
+ * @internal
79
+ */
80
+ public _Is_simple(): boolean {
81
+ return (
82
+ this.properties.length < 4 &&
83
+ this.properties.every(
84
+ (property) =>
85
+ property.key.isSoleLiteral() &&
86
+ property.value.size() === 1 &&
87
+ property.value.atomics.length === 1 &&
88
+ property.value.nullable === false &&
89
+ property.value.required === true,
90
+ )
91
+ );
92
+ }
93
+
94
+ public toJSON(): IMetadataObject {
95
+ return {
96
+ name: this.name,
97
+ properties: this.properties.map((property) => property.toJSON()),
98
+ description: this.description,
99
+ jsDocTags: this.jsDocTags,
100
+
101
+ index: this.index,
102
+ validated: this.validated,
103
+ recursive: this.recursive,
104
+ nullables: this.nullables.slice(),
105
+ };
106
+ }
107
+ }
108
+
109
+ /**
110
+ * @internal
111
+ */
112
+ export namespace MetadataObject {
113
+ export function intersects(x: MetadataObject, y: MetadataObject): boolean {
114
+ return x.properties.some(
115
+ (prop) =>
116
+ y.properties.find((oppo) => prop.key === oppo.key) !==
117
+ undefined,
118
+ );
119
+ }
120
+
121
+ export function covers(x: MetadataObject, y: MetadataObject): boolean {
122
+ return (
123
+ x.properties.length >= y.properties.length &&
124
+ x.properties.every(
125
+ (prop) =>
126
+ y.properties.find((oppo) => prop.key === oppo.key) !==
127
+ undefined,
128
+ )
129
+ );
130
+ }
131
+ }
@@ -1,64 +1,64 @@
1
- import { ClassProperties } from "../typings/ClassProperties";
2
-
3
- import { IJsDocTagInfo } from "./IJsDocTagInfo";
4
- import { IMetadataProperty } from "./IMetadataProperty";
5
- import { IMetadataTag } from "./IMetadataTag";
6
- import { Metadata } from "./Metadata";
7
- import { MetadataObject } from "./MetadataObject";
8
-
9
- export class MetadataProperty {
10
- public readonly key: Metadata;
11
- public readonly value: Metadata;
12
- public readonly description: string | undefined;
13
- public readonly tags: IMetadataTag[];
14
- public readonly jsDocTags: IJsDocTagInfo[];
15
-
16
- /* -----------------------------------------------------------
17
- CONSTRUCTORS
18
- ----------------------------------------------------------- */
19
- /**
20
- * @hidden
21
- */
22
- private constructor(props: ClassProperties<MetadataProperty>) {
23
- this.key = props.key;
24
- this.value = props.value;
25
- this.description = props.description;
26
- this.tags = props.tags;
27
- this.jsDocTags = props.jsDocTags;
28
- }
29
-
30
- /**
31
- * @internal
32
- */
33
- public static create(
34
- props: ClassProperties<MetadataProperty>,
35
- ): MetadataProperty {
36
- return new MetadataProperty(props);
37
- }
38
-
39
- /**
40
- * @internal
41
- */
42
- public static _From(
43
- property: IMetadataProperty,
44
- objects: Map<string, MetadataObject>,
45
- ) {
46
- return this.create({
47
- key: Metadata._From(property.key, objects),
48
- value: Metadata._From(property.value, objects),
49
- description: property.description,
50
- tags: property.tags.slice(),
51
- jsDocTags: property.jsDocTags.slice(),
52
- });
53
- }
54
-
55
- public toJSON(): IMetadataProperty {
56
- return {
57
- key: this.key.toJSON(),
58
- value: this.value.toJSON(),
59
- description: this.description,
60
- tags: this.tags,
61
- jsDocTags: this.jsDocTags,
62
- };
63
- }
64
- }
1
+ import { ClassProperties } from "../typings/ClassProperties";
2
+
3
+ import { IJsDocTagInfo } from "./IJsDocTagInfo";
4
+ import { IMetadataProperty } from "./IMetadataProperty";
5
+ import { IMetadataTag } from "./IMetadataTag";
6
+ import { Metadata } from "./Metadata";
7
+ import { MetadataObject } from "./MetadataObject";
8
+
9
+ export class MetadataProperty {
10
+ public readonly key: Metadata;
11
+ public readonly value: Metadata;
12
+ public readonly description: string | undefined;
13
+ public readonly tags: IMetadataTag[];
14
+ public readonly jsDocTags: IJsDocTagInfo[];
15
+
16
+ /* -----------------------------------------------------------
17
+ CONSTRUCTORS
18
+ ----------------------------------------------------------- */
19
+ /**
20
+ * @hidden
21
+ */
22
+ private constructor(props: ClassProperties<MetadataProperty>) {
23
+ this.key = props.key;
24
+ this.value = props.value;
25
+ this.description = props.description;
26
+ this.tags = props.tags;
27
+ this.jsDocTags = props.jsDocTags;
28
+ }
29
+
30
+ /**
31
+ * @internal
32
+ */
33
+ public static create(
34
+ props: ClassProperties<MetadataProperty>,
35
+ ): MetadataProperty {
36
+ return new MetadataProperty(props);
37
+ }
38
+
39
+ /**
40
+ * @internal
41
+ */
42
+ public static _From(
43
+ property: IMetadataProperty,
44
+ objects: Map<string, MetadataObject>,
45
+ ) {
46
+ return this.create({
47
+ key: Metadata._From(property.key, objects),
48
+ value: Metadata._From(property.value, objects),
49
+ description: property.description,
50
+ tags: property.tags.slice(),
51
+ jsDocTags: property.jsDocTags.slice(),
52
+ });
53
+ }
54
+
55
+ public toJSON(): IMetadataProperty {
56
+ return {
57
+ key: this.key.toJSON(),
58
+ value: this.value.toJSON(),
59
+ description: this.description,
60
+ tags: this.tags,
61
+ jsDocTags: this.jsDocTags,
62
+ };
63
+ }
64
+ }
@@ -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
+ }
@@ -280,7 +280,7 @@ export namespace AssertProgrammer {
280
280
  (equals: boolean) =>
281
281
  (importer: FunctionImporter): CheckerProgrammer.IConfig.Combiner =>
282
282
  (explore: CheckerProgrammer.IExplore) => {
283
- if (explore.tracable === false && explore.from !== "top")
283
+ if (explore.tracable === false)
284
284
  return IsProgrammer.CONFIG({
285
285
  object: assert_object(equals)(importer),
286
286
  numeric: true,