typia 3.4.15 → 3.5.0-dev.20221222

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 (169) hide show
  1. package/README.md +48 -7
  2. package/lib/factories/MetadataCollection.d.ts +1 -9
  3. package/lib/factories/MetadataCollection.js +2 -75
  4. package/lib/factories/MetadataCollection.js.map +1 -1
  5. package/lib/factories/ProtocolFactory.d.ts +8 -0
  6. package/lib/factories/ProtocolFactory.js +119 -0
  7. package/lib/factories/ProtocolFactory.js.map +1 -0
  8. package/lib/factories/internal/protocols/ProtocolMetadataUtil.d.ts +11 -0
  9. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js +76 -0
  10. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js.map +1 -0
  11. package/lib/factories/internal/protocols/emplace_protocol_object.d.ts +3 -0
  12. package/lib/factories/internal/protocols/emplace_protocol_object.js +47 -0
  13. package/lib/factories/internal/protocols/emplace_protocol_object.js.map +1 -0
  14. package/lib/factories/internal/protocols/emplace_protocol_property.d.ts +4 -0
  15. package/lib/factories/internal/protocols/emplace_protocol_property.js +20 -0
  16. package/lib/factories/internal/protocols/emplace_protocol_property.js.map +1 -0
  17. package/lib/factories/internal/protocols/iterate_protocol_atomic.d.ts +3 -0
  18. package/lib/factories/internal/protocols/iterate_protocol_atomic.js +69 -0
  19. package/lib/factories/internal/protocols/iterate_protocol_atomic.js.map +1 -0
  20. package/lib/factories/internal/protocols/iterate_protocol_constant.d.ts +2 -0
  21. package/lib/factories/internal/protocols/iterate_protocol_constant.js +30 -0
  22. package/lib/factories/internal/protocols/iterate_protocol_constant.js.map +1 -0
  23. package/lib/factories/internal/protocols/iterate_protocol_main.d.ts +3 -0
  24. package/lib/factories/internal/protocols/iterate_protocol_main.js +17 -0
  25. package/lib/factories/internal/protocols/iterate_protocol_main.js.map +1 -0
  26. package/lib/factories/internal/protocols/iterate_protocol_map.d.ts +3 -0
  27. package/lib/factories/internal/protocols/iterate_protocol_map.js +71 -0
  28. package/lib/factories/internal/protocols/iterate_protocol_map.js.map +1 -0
  29. package/lib/factories/internal/protocols/iterate_protocol_metadata.d.ts +5 -0
  30. package/lib/factories/internal/protocols/iterate_protocol_metadata.js +192 -0
  31. package/lib/factories/internal/protocols/iterate_protocol_metadata.js.map +1 -0
  32. package/lib/factories/internal/protocols/iterate_protocol_native.d.ts +2 -0
  33. package/lib/factories/internal/protocols/iterate_protocol_native.js +33 -0
  34. package/lib/factories/internal/protocols/iterate_protocol_native.js.map +1 -0
  35. package/lib/factories/internal/protocols/iterate_protocol_repeated.d.ts +4 -0
  36. package/lib/factories/internal/protocols/iterate_protocol_repeated.js +24 -0
  37. package/lib/factories/internal/protocols/iterate_protocol_repeated.js.map +1 -0
  38. package/lib/factories/internal/protocols/iterate_protocol_tuple.d.ts +3 -0
  39. package/lib/factories/internal/protocols/iterate_protocol_tuple.js +46 -0
  40. package/lib/factories/internal/protocols/iterate_protocol_tuple.js.map +1 -0
  41. package/lib/functional/$proto_bytes.d.ts +2 -0
  42. package/lib/functional/$proto_bytes.js +37 -0
  43. package/lib/functional/$proto_bytes.js.map +1 -0
  44. package/lib/functional/$proto_field.d.ts +10 -0
  45. package/lib/functional/$proto_field.js +42 -0
  46. package/lib/functional/$proto_field.js.map +1 -0
  47. package/lib/functional/$proto_float.d.ts +4 -0
  48. package/lib/functional/$proto_float.js +28 -0
  49. package/lib/functional/$proto_float.js.map +1 -0
  50. package/lib/functional/$proto_i32.d.ts +2 -0
  51. package/lib/functional/$proto_i32.js +23 -0
  52. package/lib/functional/$proto_i32.js.map +1 -0
  53. package/lib/functional/$proto_i64.d.ts +2 -0
  54. package/lib/functional/$proto_i64.js +31 -0
  55. package/lib/functional/$proto_i64.js.map +1 -0
  56. package/lib/functional/$proto_size.d.ts +6 -0
  57. package/lib/functional/$proto_size.js +76 -0
  58. package/lib/functional/$proto_size.js.map +1 -0
  59. package/lib/functional/$proto_string.d.ts +2 -0
  60. package/lib/functional/$proto_string.js +34 -0
  61. package/lib/functional/$proto_string.js.map +1 -0
  62. package/lib/functional/$varint.d.ts +6 -0
  63. package/lib/functional/$varint.js +99 -0
  64. package/lib/functional/$varint.js.map +1 -0
  65. package/lib/functional/$zigzag.d.ts +4 -0
  66. package/lib/functional/$zigzag.js +34 -0
  67. package/lib/functional/$zigzag.js.map +1 -0
  68. package/lib/messages/IProtocolMessage.d.ts +5 -0
  69. package/lib/messages/IProtocolMessage.js +3 -0
  70. package/lib/messages/IProtocolMessage.js.map +1 -0
  71. package/lib/messages/IProtocolProperty.d.ts +11 -0
  72. package/lib/messages/IProtocolProperty.js +3 -0
  73. package/lib/messages/IProtocolProperty.js.map +1 -0
  74. package/lib/metadata/IMetadataTag.d.ts +7 -3
  75. package/lib/metadata/Metadata.js +1 -1
  76. package/lib/metadata/Metadata.js.map +1 -1
  77. package/lib/module.d.ts +2 -0
  78. package/lib/module.js +5 -1
  79. package/lib/module.js.map +1 -1
  80. package/lib/programmers/MessageProgrammer.d.ts +5 -0
  81. package/lib/programmers/MessageProgrammer.js +134 -0
  82. package/lib/programmers/MessageProgrammer.js.map +1 -0
  83. package/lib/programmers/internal/application_object.js +9 -9
  84. package/lib/programmers/internal/application_object.js.map +1 -1
  85. package/lib/programmers/internal/application_schema.js +5 -3
  86. package/lib/programmers/internal/application_schema.js.map +1 -1
  87. package/lib/transformers/CallExpressionTransformer.js +3 -1
  88. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  89. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js +1 -3
  90. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js.map +1 -1
  91. package/lib/transformers/features/protocols/MessageTransformer.d.ts +5 -0
  92. package/lib/transformers/features/protocols/MessageTransformer.js +17 -0
  93. package/lib/transformers/features/protocols/MessageTransformer.js.map +1 -0
  94. package/lib/utils/NameEncoder.d.ts +4 -0
  95. package/lib/utils/NameEncoder.js +89 -0
  96. package/lib/utils/NameEncoder.js.map +1 -0
  97. package/package.json +2 -3
  98. package/src/executable/internal/TypiaSetupWizard.ts +173 -173
  99. package/src/factories/MetadataCollection.ts +83 -122
  100. package/src/factories/MetadataFactory.ts +47 -47
  101. package/src/factories/MetadataTagFactory.ts +351 -351
  102. package/src/factories/ProtocolFactory.ts +92 -0
  103. package/src/factories/internal/metadata/MetadataHelper.ts +12 -12
  104. package/src/factories/internal/metadata/emplace_metadata_object.ts +140 -140
  105. package/src/factories/internal/metadata/explore_metadata.ts +92 -92
  106. package/src/factories/internal/metadata/iterate_metadata.ts +80 -80
  107. package/src/factories/internal/metadata/iterate_metadata_array.ts +29 -29
  108. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +59 -59
  109. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  110. package/src/factories/internal/metadata/iterate_metadata_constant.ts +58 -58
  111. package/src/factories/internal/metadata/iterate_metadata_map.ts +41 -41
  112. package/src/factories/internal/metadata/iterate_metadata_native.ts +227 -227
  113. package/src/factories/internal/metadata/iterate_metadata_object.ts +48 -48
  114. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +27 -27
  115. package/src/factories/internal/metadata/iterate_metadata_set.ts +33 -33
  116. package/src/factories/internal/metadata/iterate_metadata_template.ts +38 -38
  117. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +45 -45
  118. package/src/factories/internal/metadata/iterate_metadata_union.ts +59 -59
  119. package/src/factories/internal/protocols/ProtocolMetadataUtil.ts +81 -0
  120. package/src/factories/internal/protocols/emplace_protocol_object.ts +25 -0
  121. package/src/factories/internal/protocols/emplace_protocol_property.ts +12 -0
  122. package/src/factories/internal/protocols/iterate_protocol_atomic.ts +34 -0
  123. package/src/factories/internal/protocols/iterate_protocol_constant.ts +27 -0
  124. package/src/factories/internal/protocols/iterate_protocol_main.ts +19 -0
  125. package/src/factories/internal/protocols/iterate_protocol_map.ts +38 -0
  126. package/src/factories/internal/protocols/iterate_protocol_metadata.ts +76 -0
  127. package/src/factories/internal/protocols/iterate_protocol_native.ts +34 -0
  128. package/src/factories/internal/protocols/iterate_protocol_repeated.ts +25 -0
  129. package/src/factories/internal/protocols/iterate_protocol_tuple.ts +25 -0
  130. package/src/functional/$number.ts +12 -12
  131. package/src/functional/$proto_bytes.ts +25 -0
  132. package/src/functional/$proto_field.ts +30 -0
  133. package/src/functional/$proto_float.ts +37 -0
  134. package/src/functional/$proto_i32.ts +29 -0
  135. package/src/functional/$proto_i64.ts +37 -0
  136. package/src/functional/$proto_size.ts +82 -0
  137. package/src/functional/$proto_string.ts +24 -0
  138. package/src/functional/$varint.ts +130 -0
  139. package/src/functional/$zigzag.ts +39 -0
  140. package/src/messages/IProtocolMessage.ts +6 -0
  141. package/src/messages/IProtocolProperty.ts +11 -0
  142. package/src/metadata/IMetadataTag.ts +137 -122
  143. package/src/metadata/Metadata.ts +479 -477
  144. package/src/module.ts +1547 -1535
  145. package/src/programmers/AssertParseProgrammer.ts +55 -55
  146. package/src/programmers/AssertProgrammer.ts +445 -445
  147. package/src/programmers/AssertStringifyProgrammer.ts +65 -65
  148. package/src/programmers/CheckerProgrammer.ts +810 -810
  149. package/src/programmers/IsParseProgrammer.ts +61 -61
  150. package/src/programmers/IsProgrammer.ts +175 -175
  151. package/src/programmers/IsStringifyProgrammer.ts +69 -69
  152. package/src/programmers/MessageProgrammer.ts +116 -0
  153. package/src/programmers/StringifyProgrammer.ts +762 -762
  154. package/src/programmers/ValidateParseProgrammer.ts +59 -59
  155. package/src/programmers/ValidateProgrammer.ts +237 -237
  156. package/src/programmers/ValidateStringifyProgrammer.ts +80 -80
  157. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  158. package/src/programmers/internal/application_default.ts +17 -17
  159. package/src/programmers/internal/application_object.ts +5 -5
  160. package/src/programmers/internal/application_schema.ts +231 -228
  161. package/src/programmers/internal/check_bigint.ts +85 -85
  162. package/src/programmers/internal/check_number.ts +175 -175
  163. package/src/schemas/IJsonSchema.ts +90 -90
  164. package/src/transformers/CallExpressionTransformer.ts +131 -124
  165. package/src/transformers/ITransformOptions.ts +47 -47
  166. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +117 -119
  167. package/src/transformers/features/protocols/MessageTransformer.ts +32 -0
  168. package/src/transformers/features/stringifiers/StringifyTransformer.ts +46 -46
  169. package/src/utils/NameEncoder.ts +32 -0
@@ -1,175 +1,175 @@
1
- import ts from "typescript";
2
-
3
- import { IMetadataTag } from "../../metadata/IMetadataTag";
4
-
5
- import { IProject } from "../../transformers/IProject";
6
-
7
- import { OptionPredicator } from "../helpers/OptionPredicator";
8
-
9
- /**
10
- * @internal
11
- */
12
- export const check_number =
13
- ({ options }: IProject, numeric: boolean) =>
14
- (input: ts.Expression, tagList: IMetadataTag[]) => {
15
- // TYPEOF STATEMENT
16
- const conditions: ts.Expression[] = [
17
- ts.factory.createStrictEquality(
18
- ts.factory.createStringLiteral("number"),
19
- ts.factory.createTypeOfExpression(input),
20
- ),
21
- ];
22
-
23
- // CHECK FINITE AND NAN
24
- const finite: boolean =
25
- !!tagList.find(
26
- (tag) =>
27
- tag.kind === "range" &&
28
- tag.minimum !== undefined &&
29
- tag.maximum !== undefined,
30
- ) ||
31
- (!!tagList.find(
32
- (tag) =>
33
- tag.kind === "minimum" || tag.kind === "exclusiveMinimum",
34
- ) &&
35
- !!tagList.find(
36
- (tag) =>
37
- tag.kind === "maximum" ||
38
- tag.kind === "exclusiveMaximum",
39
- )) ||
40
- !!tagList.find(
41
- (tag) => tag.kind === "step" || tag.kind === "multipleOf",
42
- );
43
-
44
- if (numeric === true && finite === false)
45
- if (OptionPredicator.finite(options))
46
- conditions.push(
47
- ts.factory.createCallExpression(
48
- ts.factory.createIdentifier("Number.isFinite"),
49
- undefined,
50
- [input],
51
- ),
52
- );
53
- else if (OptionPredicator.numeric(options))
54
- conditions.push(
55
- ts.factory.createLogicalNot(
56
- ts.factory.createCallExpression(
57
- ts.factory.createIdentifier("Number.isNaN"),
58
- undefined,
59
- [input],
60
- ),
61
- ),
62
- );
63
-
64
- // TAG (RANGE)
65
- for (const tag of tagList)
66
- if (tag.kind === "type") {
67
- conditions.push(
68
- ts.factory.createStrictEquality(
69
- ts.factory.createCallExpression(
70
- ts.factory.createIdentifier("parseInt"),
71
- undefined,
72
- [input],
73
- ),
74
- input,
75
- ),
76
- );
77
- if (tag.value === "uint")
78
- conditions.push(
79
- ts.factory.createLessThanEquals(
80
- ts.factory.createNumericLiteral(0),
81
- input,
82
- ),
83
- );
84
- } else if (tag.kind === "multipleOf")
85
- conditions.push(
86
- ts.factory.createStrictEquality(
87
- ts.factory.createNumericLiteral(0),
88
- ts.factory.createModulo(
89
- input,
90
- ts.factory.createNumericLiteral(tag.value),
91
- ),
92
- ),
93
- );
94
- else if (tag.kind === "step") {
95
- const modulo = () =>
96
- ts.factory.createModulo(
97
- input,
98
- ts.factory.createNumericLiteral(tag.value),
99
- );
100
- const minimum = (() => {
101
- for (const tag of tagList)
102
- if (tag.kind === "minimum") return tag.value;
103
- else if (tag.kind === "exclusiveMinimum")
104
- return tag.value;
105
- else if (
106
- tag.kind === "range" &&
107
- tag.minimum !== undefined
108
- )
109
- return tag.minimum.value;
110
- return undefined;
111
- })();
112
- conditions.push(
113
- ts.factory.createStrictEquality(
114
- ts.factory.createNumericLiteral(0),
115
- minimum !== undefined
116
- ? ts.factory.createSubtract(
117
- modulo(),
118
- ts.factory.createNumericLiteral(minimum),
119
- )
120
- : modulo(),
121
- ),
122
- );
123
- } else if (tag.kind === "range") {
124
- if (tag.minimum !== undefined)
125
- conditions.push(
126
- (tag.minimum.include
127
- ? ts.factory.createLessThanEquals
128
- : ts.factory.createLessThan)(
129
- ts.factory.createNumericLiteral(tag.minimum.value),
130
- input,
131
- ),
132
- );
133
- if (tag.maximum !== undefined)
134
- conditions.push(
135
- (tag.maximum.include
136
- ? ts.factory.createLessThanEquals
137
- : ts.factory.createLessThan)(
138
- input,
139
- ts.factory.createNumericLiteral(tag.maximum.value),
140
- ),
141
- );
142
- } else if (tag.kind === "minimum")
143
- conditions.push(
144
- ts.factory.createLessThanEquals(
145
- ts.factory.createNumericLiteral(tag.value),
146
- input,
147
- ),
148
- );
149
- else if (tag.kind === "maximum")
150
- conditions.push(
151
- ts.factory.createGreaterThanEquals(
152
- ts.factory.createNumericLiteral(tag.value),
153
- input,
154
- ),
155
- );
156
- else if (tag.kind === "exclusiveMinimum")
157
- conditions.push(
158
- ts.factory.createLessThan(
159
- ts.factory.createNumericLiteral(tag.value),
160
- input,
161
- ),
162
- );
163
- else if (tag.kind === "exclusiveMaximum")
164
- conditions.push(
165
- ts.factory.createGreaterThan(
166
- ts.factory.createNumericLiteral(tag.value),
167
- input,
168
- ),
169
- );
170
-
171
- // COMBINATION
172
- return conditions.length === 1
173
- ? conditions[0]!
174
- : conditions.reduce((x, y) => ts.factory.createLogicalAnd(x, y));
175
- };
1
+ import ts from "typescript";
2
+
3
+ import { IMetadataTag } from "../../metadata/IMetadataTag";
4
+
5
+ import { IProject } from "../../transformers/IProject";
6
+
7
+ import { OptionPredicator } from "../helpers/OptionPredicator";
8
+
9
+ /**
10
+ * @internal
11
+ */
12
+ export const check_number =
13
+ ({ options }: IProject, numeric: boolean) =>
14
+ (input: ts.Expression, tagList: IMetadataTag[]) => {
15
+ // TYPEOF STATEMENT
16
+ const conditions: ts.Expression[] = [
17
+ ts.factory.createStrictEquality(
18
+ ts.factory.createStringLiteral("number"),
19
+ ts.factory.createTypeOfExpression(input),
20
+ ),
21
+ ];
22
+
23
+ // CHECK FINITE AND NAN
24
+ const finite: boolean =
25
+ !!tagList.find(
26
+ (tag) =>
27
+ tag.kind === "range" &&
28
+ tag.minimum !== undefined &&
29
+ tag.maximum !== undefined,
30
+ ) ||
31
+ (!!tagList.find(
32
+ (tag) =>
33
+ tag.kind === "minimum" || tag.kind === "exclusiveMinimum",
34
+ ) &&
35
+ !!tagList.find(
36
+ (tag) =>
37
+ tag.kind === "maximum" ||
38
+ tag.kind === "exclusiveMaximum",
39
+ )) ||
40
+ !!tagList.find(
41
+ (tag) => tag.kind === "step" || tag.kind === "multipleOf",
42
+ );
43
+
44
+ if (numeric === true && finite === false)
45
+ if (OptionPredicator.finite(options))
46
+ conditions.push(
47
+ ts.factory.createCallExpression(
48
+ ts.factory.createIdentifier("Number.isFinite"),
49
+ undefined,
50
+ [input],
51
+ ),
52
+ );
53
+ else if (OptionPredicator.numeric(options))
54
+ conditions.push(
55
+ ts.factory.createLogicalNot(
56
+ ts.factory.createCallExpression(
57
+ ts.factory.createIdentifier("Number.isNaN"),
58
+ undefined,
59
+ [input],
60
+ ),
61
+ ),
62
+ );
63
+
64
+ // TAG (RANGE)
65
+ for (const tag of tagList)
66
+ if (tag.kind === "type") {
67
+ conditions.push(
68
+ ts.factory.createStrictEquality(
69
+ ts.factory.createCallExpression(
70
+ ts.factory.createIdentifier("parseInt"),
71
+ undefined,
72
+ [input],
73
+ ),
74
+ input,
75
+ ),
76
+ );
77
+ if (tag.value === "uint")
78
+ conditions.push(
79
+ ts.factory.createLessThanEquals(
80
+ ts.factory.createNumericLiteral(0),
81
+ input,
82
+ ),
83
+ );
84
+ } else if (tag.kind === "multipleOf")
85
+ conditions.push(
86
+ ts.factory.createStrictEquality(
87
+ ts.factory.createNumericLiteral(0),
88
+ ts.factory.createModulo(
89
+ input,
90
+ ts.factory.createNumericLiteral(tag.value),
91
+ ),
92
+ ),
93
+ );
94
+ else if (tag.kind === "step") {
95
+ const modulo = () =>
96
+ ts.factory.createModulo(
97
+ input,
98
+ ts.factory.createNumericLiteral(tag.value),
99
+ );
100
+ const minimum = (() => {
101
+ for (const tag of tagList)
102
+ if (tag.kind === "minimum") return tag.value;
103
+ else if (tag.kind === "exclusiveMinimum")
104
+ return tag.value;
105
+ else if (
106
+ tag.kind === "range" &&
107
+ tag.minimum !== undefined
108
+ )
109
+ return tag.minimum.value;
110
+ return undefined;
111
+ })();
112
+ conditions.push(
113
+ ts.factory.createStrictEquality(
114
+ ts.factory.createNumericLiteral(0),
115
+ minimum !== undefined
116
+ ? ts.factory.createSubtract(
117
+ modulo(),
118
+ ts.factory.createNumericLiteral(minimum),
119
+ )
120
+ : modulo(),
121
+ ),
122
+ );
123
+ } else if (tag.kind === "range") {
124
+ if (tag.minimum !== undefined)
125
+ conditions.push(
126
+ (tag.minimum.include
127
+ ? ts.factory.createLessThanEquals
128
+ : ts.factory.createLessThan)(
129
+ ts.factory.createNumericLiteral(tag.minimum.value),
130
+ input,
131
+ ),
132
+ );
133
+ if (tag.maximum !== undefined)
134
+ conditions.push(
135
+ (tag.maximum.include
136
+ ? ts.factory.createLessThanEquals
137
+ : ts.factory.createLessThan)(
138
+ input,
139
+ ts.factory.createNumericLiteral(tag.maximum.value),
140
+ ),
141
+ );
142
+ } else if (tag.kind === "minimum")
143
+ conditions.push(
144
+ ts.factory.createLessThanEquals(
145
+ ts.factory.createNumericLiteral(tag.value),
146
+ input,
147
+ ),
148
+ );
149
+ else if (tag.kind === "maximum")
150
+ conditions.push(
151
+ ts.factory.createGreaterThanEquals(
152
+ ts.factory.createNumericLiteral(tag.value),
153
+ input,
154
+ ),
155
+ );
156
+ else if (tag.kind === "exclusiveMinimum")
157
+ conditions.push(
158
+ ts.factory.createLessThan(
159
+ ts.factory.createNumericLiteral(tag.value),
160
+ input,
161
+ ),
162
+ );
163
+ else if (tag.kind === "exclusiveMaximum")
164
+ conditions.push(
165
+ ts.factory.createGreaterThan(
166
+ ts.factory.createNumericLiteral(tag.value),
167
+ input,
168
+ ),
169
+ );
170
+
171
+ // COMBINATION
172
+ return conditions.length === 1
173
+ ? conditions[0]!
174
+ : conditions.reduce((x, y) => ts.factory.createLogicalAnd(x, y));
175
+ };
@@ -1,90 +1,90 @@
1
- import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
2
- import { IMetadataTag } from "../metadata/IMetadataTag";
3
-
4
- import { Atomic } from "../typings/Atomic";
5
-
6
- export type IJsonSchema = IJsonSchema.NotUnknown | IJsonSchema.IUnknown;
7
- export namespace IJsonSchema {
8
- export type NotUnknown =
9
- | IEnumeration<"boolean">
10
- | IEnumeration<"number">
11
- | IEnumeration<"string">
12
- | IBoolean
13
- | INumber
14
- | IString
15
- | IArray
16
- | ITuple
17
- | IOneOf
18
- | IReference
19
- | IRecursiveReference
20
- | INullOnly;
21
-
22
- /* -----------------------------------------------------------
23
- ATOMICS
24
- ----------------------------------------------------------- */
25
- export interface IEnumeration<
26
- Literal extends Exclude<Atomic.Literal, "bigint">,
27
- > extends IAtomic<Literal> {
28
- enum: Array<Atomic.Mapper[Literal]>;
29
- }
30
- export interface IAtomic<Literal extends Exclude<Atomic.Literal, "bigint">>
31
- extends ISignificant<Literal> {
32
- default?: Atomic.Mapper[Literal];
33
- }
34
- export interface IString extends IAtomic<"string"> {
35
- minLength?: number;
36
- maxLength?: number;
37
- pattern?: string;
38
- format?: string;
39
- }
40
- export interface INumber extends IAtomic<"number" | "integer"> {
41
- minimum?: number;
42
- maximum?: number;
43
- exclusiveMinimum?: number;
44
- exclusiveMaximum?: number;
45
- multipleOf?: number;
46
- }
47
- export interface IBoolean extends IAtomic<"boolean"> {}
48
-
49
- /* -----------------------------------------------------------
50
- OBJECTS
51
- ----------------------------------------------------------- */
52
- export interface IArray extends ISignificant<"array"> {
53
- items: IJsonSchema;
54
- minItems?: number;
55
- maxItems?: number;
56
- }
57
- export interface ITuple extends ISignificant<"array"> {
58
- items: IJsonSchema[];
59
- }
60
- export interface IReference extends IAttribute {
61
- $ref: string;
62
- }
63
- export interface IRecursiveReference extends IAttribute {
64
- $recursiveRef: string;
65
- }
66
- export interface INullOnly extends IAttribute {
67
- type: "null";
68
- }
69
-
70
- /* -----------------------------------------------------------
71
- MISCELLANEOUS
72
- ----------------------------------------------------------- */
73
- export interface IOneOf extends IAttribute {
74
- oneOf: IJsonSchema[];
75
- }
76
- export interface IUnknown {}
77
-
78
- export interface ISignificant<Literal extends string> extends IAttribute {
79
- type: Literal;
80
- nullable: boolean;
81
- }
82
- export interface IAttribute {
83
- deprecated?: boolean;
84
- title?: string;
85
- description?: string;
86
- "x-typia-metaTags"?: IMetadataTag[];
87
- "x-typia-jsDocTags"?: IJsDocTagInfo[];
88
- "x-typia-required"?: boolean;
89
- }
90
- }
1
+ import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
2
+ import { IMetadataTag } from "../metadata/IMetadataTag";
3
+
4
+ import { Atomic } from "../typings/Atomic";
5
+
6
+ export type IJsonSchema = IJsonSchema.NotUnknown | IJsonSchema.IUnknown;
7
+ export namespace IJsonSchema {
8
+ export type NotUnknown =
9
+ | IEnumeration<"boolean">
10
+ | IEnumeration<"number">
11
+ | IEnumeration<"string">
12
+ | IBoolean
13
+ | INumber
14
+ | IString
15
+ | IArray
16
+ | ITuple
17
+ | IOneOf
18
+ | IReference
19
+ | IRecursiveReference
20
+ | INullOnly;
21
+
22
+ /* -----------------------------------------------------------
23
+ ATOMICS
24
+ ----------------------------------------------------------- */
25
+ export interface IEnumeration<
26
+ Literal extends Exclude<Atomic.Literal, "bigint">,
27
+ > extends IAtomic<Literal> {
28
+ enum: Array<Atomic.Mapper[Literal]>;
29
+ }
30
+ export interface IAtomic<Literal extends Exclude<Atomic.Literal, "bigint">>
31
+ extends ISignificant<Literal> {
32
+ default?: Atomic.Mapper[Literal];
33
+ }
34
+ export interface IString extends IAtomic<"string"> {
35
+ minLength?: number;
36
+ maxLength?: number;
37
+ pattern?: string;
38
+ format?: string;
39
+ }
40
+ export interface INumber extends IAtomic<"number" | "integer"> {
41
+ minimum?: number;
42
+ maximum?: number;
43
+ exclusiveMinimum?: number;
44
+ exclusiveMaximum?: number;
45
+ multipleOf?: number;
46
+ }
47
+ export interface IBoolean extends IAtomic<"boolean"> {}
48
+
49
+ /* -----------------------------------------------------------
50
+ OBJECTS
51
+ ----------------------------------------------------------- */
52
+ export interface IArray extends ISignificant<"array"> {
53
+ items: IJsonSchema;
54
+ minItems?: number;
55
+ maxItems?: number;
56
+ }
57
+ export interface ITuple extends ISignificant<"array"> {
58
+ items: IJsonSchema[];
59
+ }
60
+ export interface IReference extends IAttribute {
61
+ $ref: string;
62
+ }
63
+ export interface IRecursiveReference extends IAttribute {
64
+ $recursiveRef: string;
65
+ }
66
+ export interface INullOnly extends IAttribute {
67
+ type: "null";
68
+ }
69
+
70
+ /* -----------------------------------------------------------
71
+ MISCELLANEOUS
72
+ ----------------------------------------------------------- */
73
+ export interface IOneOf extends IAttribute {
74
+ oneOf: IJsonSchema[];
75
+ }
76
+ export interface IUnknown {}
77
+
78
+ export interface ISignificant<Literal extends string> extends IAttribute {
79
+ type: Literal;
80
+ nullable: boolean;
81
+ }
82
+ export interface IAttribute {
83
+ deprecated?: boolean;
84
+ title?: string;
85
+ description?: string;
86
+ "x-typia-metaTags"?: IMetadataTag[];
87
+ "x-typia-jsDocTags"?: IJsDocTagInfo[];
88
+ "x-typia-required"?: boolean;
89
+ }
90
+ }