@typia/interface 12.0.0-dev.20260225

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 (311) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/lib/http/IHttpConnection.d.ts +163 -0
  4. package/lib/http/IHttpConnection.js +4 -0
  5. package/lib/http/IHttpConnection.js.map +1 -0
  6. package/lib/http/IHttpLlmApplication.d.ts +73 -0
  7. package/lib/http/IHttpLlmApplication.js +3 -0
  8. package/lib/http/IHttpLlmApplication.js.map +1 -0
  9. package/lib/http/IHttpLlmController.d.ts +86 -0
  10. package/lib/http/IHttpLlmController.js +3 -0
  11. package/lib/http/IHttpLlmController.js.map +1 -0
  12. package/lib/http/IHttpLlmFunction.d.ts +79 -0
  13. package/lib/http/IHttpLlmFunction.js +3 -0
  14. package/lib/http/IHttpLlmFunction.js.map +1 -0
  15. package/lib/http/IHttpMigrateApplication.d.ts +42 -0
  16. package/lib/http/IHttpMigrateApplication.js +3 -0
  17. package/lib/http/IHttpMigrateApplication.js.map +1 -0
  18. package/lib/http/IHttpMigrateRoute.d.ts +121 -0
  19. package/lib/http/IHttpMigrateRoute.js +3 -0
  20. package/lib/http/IHttpMigrateRoute.js.map +1 -0
  21. package/lib/http/IHttpResponse.d.ts +40 -0
  22. package/lib/http/IHttpResponse.js +3 -0
  23. package/lib/http/IHttpResponse.js.map +1 -0
  24. package/lib/http/index.d.ts +7 -0
  25. package/lib/http/index.js +24 -0
  26. package/lib/http/index.js.map +1 -0
  27. package/lib/index.d.ts +8 -0
  28. package/lib/index.js +48 -0
  29. package/lib/index.js.map +1 -0
  30. package/lib/metadata/IJsDocTagInfo.d.ts +23 -0
  31. package/lib/metadata/IJsDocTagInfo.js +3 -0
  32. package/lib/metadata/IJsDocTagInfo.js.map +1 -0
  33. package/lib/metadata/IMetadataComponents.d.ts +20 -0
  34. package/lib/metadata/IMetadataComponents.js +3 -0
  35. package/lib/metadata/IMetadataComponents.js.map +1 -0
  36. package/lib/metadata/IMetadataSchema.d.ts +219 -0
  37. package/lib/metadata/IMetadataSchema.js +3 -0
  38. package/lib/metadata/IMetadataSchema.js.map +1 -0
  39. package/lib/metadata/IMetadataSchemaCollection.d.ts +18 -0
  40. package/lib/metadata/IMetadataSchemaCollection.js +3 -0
  41. package/lib/metadata/IMetadataSchemaCollection.js.map +1 -0
  42. package/lib/metadata/IMetadataSchemaUnit.d.ts +18 -0
  43. package/lib/metadata/IMetadataSchemaUnit.js +3 -0
  44. package/lib/metadata/IMetadataSchemaUnit.js.map +1 -0
  45. package/lib/metadata/IMetadataTypeTag.d.ts +28 -0
  46. package/lib/metadata/IMetadataTypeTag.js +3 -0
  47. package/lib/metadata/IMetadataTypeTag.js.map +1 -0
  48. package/lib/metadata/index.d.ts +6 -0
  49. package/lib/metadata/index.js +23 -0
  50. package/lib/metadata/index.js.map +1 -0
  51. package/lib/openapi/OpenApi.d.ts +454 -0
  52. package/lib/openapi/OpenApi.js +3 -0
  53. package/lib/openapi/OpenApi.js.map +1 -0
  54. package/lib/openapi/OpenApiV3.d.ts +420 -0
  55. package/lib/openapi/OpenApiV3.js +3 -0
  56. package/lib/openapi/OpenApiV3.js.map +1 -0
  57. package/lib/openapi/OpenApiV3_1.d.ts +463 -0
  58. package/lib/openapi/OpenApiV3_1.js +3 -0
  59. package/lib/openapi/OpenApiV3_1.js.map +1 -0
  60. package/lib/openapi/SwaggerV2.d.ts +343 -0
  61. package/lib/openapi/SwaggerV2.js +3 -0
  62. package/lib/openapi/SwaggerV2.js.map +1 -0
  63. package/lib/openapi/index.d.ts +4 -0
  64. package/lib/openapi/index.js +21 -0
  65. package/lib/openapi/index.js.map +1 -0
  66. package/lib/protobuf/ProtobufWire.d.ts +46 -0
  67. package/lib/protobuf/ProtobufWire.js +3 -0
  68. package/lib/protobuf/ProtobufWire.js.map +1 -0
  69. package/lib/protobuf/index.d.ts +1 -0
  70. package/lib/protobuf/index.js +18 -0
  71. package/lib/protobuf/index.js.map +1 -0
  72. package/lib/schema/IJsonSchemaApplication.d.ts +232 -0
  73. package/lib/schema/IJsonSchemaApplication.js +3 -0
  74. package/lib/schema/IJsonSchemaApplication.js.map +1 -0
  75. package/lib/schema/IJsonSchemaAttribute.d.ts +152 -0
  76. package/lib/schema/IJsonSchemaAttribute.js +3 -0
  77. package/lib/schema/IJsonSchemaAttribute.js.map +1 -0
  78. package/lib/schema/IJsonSchemaCollection.d.ts +109 -0
  79. package/lib/schema/IJsonSchemaCollection.js +3 -0
  80. package/lib/schema/IJsonSchemaCollection.js.map +1 -0
  81. package/lib/schema/IJsonSchemaTransformError.d.ts +81 -0
  82. package/lib/schema/IJsonSchemaTransformError.js +3 -0
  83. package/lib/schema/IJsonSchemaTransformError.js.map +1 -0
  84. package/lib/schema/IJsonSchemaUnit.d.ts +106 -0
  85. package/lib/schema/IJsonSchemaUnit.js +3 -0
  86. package/lib/schema/IJsonSchemaUnit.js.map +1 -0
  87. package/lib/schema/ILlmApplication.d.ts +95 -0
  88. package/lib/schema/ILlmApplication.js +3 -0
  89. package/lib/schema/ILlmApplication.js.map +1 -0
  90. package/lib/schema/ILlmController.d.ts +53 -0
  91. package/lib/schema/ILlmController.js +3 -0
  92. package/lib/schema/ILlmController.js.map +1 -0
  93. package/lib/schema/ILlmFunction.d.ts +134 -0
  94. package/lib/schema/ILlmFunction.js +3 -0
  95. package/lib/schema/ILlmFunction.js.map +1 -0
  96. package/lib/schema/ILlmSchema.d.ts +412 -0
  97. package/lib/schema/ILlmSchema.js +3 -0
  98. package/lib/schema/ILlmSchema.js.map +1 -0
  99. package/lib/schema/IResult.d.ts +81 -0
  100. package/lib/schema/IResult.js +3 -0
  101. package/lib/schema/IResult.js.map +1 -0
  102. package/lib/schema/IValidation.d.ts +123 -0
  103. package/lib/schema/IValidation.js +3 -0
  104. package/lib/schema/IValidation.js.map +1 -0
  105. package/lib/schema/index.d.ts +11 -0
  106. package/lib/schema/index.js +28 -0
  107. package/lib/schema/index.js.map +1 -0
  108. package/lib/tags/Constant.d.ts +44 -0
  109. package/lib/tags/Constant.js +3 -0
  110. package/lib/tags/Constant.js.map +1 -0
  111. package/lib/tags/ContentMediaType.d.ts +39 -0
  112. package/lib/tags/ContentMediaType.js +3 -0
  113. package/lib/tags/ContentMediaType.js.map +1 -0
  114. package/lib/tags/Default.d.ts +42 -0
  115. package/lib/tags/Default.js +3 -0
  116. package/lib/tags/Default.js.map +1 -0
  117. package/lib/tags/Example.d.ts +38 -0
  118. package/lib/tags/Example.js +3 -0
  119. package/lib/tags/Example.js.map +1 -0
  120. package/lib/tags/Examples.d.ts +44 -0
  121. package/lib/tags/Examples.js +3 -0
  122. package/lib/tags/Examples.js.map +1 -0
  123. package/lib/tags/ExclusiveMaximum.d.ts +39 -0
  124. package/lib/tags/ExclusiveMaximum.js +3 -0
  125. package/lib/tags/ExclusiveMaximum.js.map +1 -0
  126. package/lib/tags/ExclusiveMinimum.d.ts +39 -0
  127. package/lib/tags/ExclusiveMinimum.js +3 -0
  128. package/lib/tags/ExclusiveMinimum.js.map +1 -0
  129. package/lib/tags/Format.d.ts +43 -0
  130. package/lib/tags/Format.js +3 -0
  131. package/lib/tags/Format.js.map +1 -0
  132. package/lib/tags/JsonSchemaPlugin.d.ts +44 -0
  133. package/lib/tags/JsonSchemaPlugin.js +3 -0
  134. package/lib/tags/JsonSchemaPlugin.js.map +1 -0
  135. package/lib/tags/MaxItems.d.ts +38 -0
  136. package/lib/tags/MaxItems.js +3 -0
  137. package/lib/tags/MaxItems.js.map +1 -0
  138. package/lib/tags/MaxLength.d.ts +36 -0
  139. package/lib/tags/MaxLength.js +3 -0
  140. package/lib/tags/MaxLength.js.map +1 -0
  141. package/lib/tags/Maximum.d.ts +41 -0
  142. package/lib/tags/Maximum.js +3 -0
  143. package/lib/tags/Maximum.js.map +1 -0
  144. package/lib/tags/MinItems.d.ts +38 -0
  145. package/lib/tags/MinItems.js +3 -0
  146. package/lib/tags/MinItems.js.map +1 -0
  147. package/lib/tags/MinLength.d.ts +36 -0
  148. package/lib/tags/MinLength.js +3 -0
  149. package/lib/tags/MinLength.js.map +1 -0
  150. package/lib/tags/Minimum.d.ts +41 -0
  151. package/lib/tags/Minimum.js +3 -0
  152. package/lib/tags/Minimum.js.map +1 -0
  153. package/lib/tags/MultipleOf.d.ts +49 -0
  154. package/lib/tags/MultipleOf.js +3 -0
  155. package/lib/tags/MultipleOf.js.map +1 -0
  156. package/lib/tags/Pattern.d.ts +51 -0
  157. package/lib/tags/Pattern.js +3 -0
  158. package/lib/tags/Pattern.js.map +1 -0
  159. package/lib/tags/Sequence.d.ts +42 -0
  160. package/lib/tags/Sequence.js +3 -0
  161. package/lib/tags/Sequence.js.map +1 -0
  162. package/lib/tags/TagBase.d.ts +109 -0
  163. package/lib/tags/TagBase.js +3 -0
  164. package/lib/tags/TagBase.js.map +1 -0
  165. package/lib/tags/Type.d.ts +53 -0
  166. package/lib/tags/Type.js +3 -0
  167. package/lib/tags/Type.js.map +1 -0
  168. package/lib/tags/UniqueItems.d.ts +41 -0
  169. package/lib/tags/UniqueItems.js +3 -0
  170. package/lib/tags/UniqueItems.js.map +1 -0
  171. package/lib/tags/index.d.ts +21 -0
  172. package/lib/tags/index.js +38 -0
  173. package/lib/tags/index.js.map +1 -0
  174. package/lib/typings/AssertionGuard.d.ts +12 -0
  175. package/lib/typings/AssertionGuard.js +3 -0
  176. package/lib/typings/AssertionGuard.js.map +1 -0
  177. package/lib/typings/Atomic.d.ts +19 -0
  178. package/lib/typings/Atomic.js +3 -0
  179. package/lib/typings/Atomic.js.map +1 -0
  180. package/lib/typings/CamelCase.d.ts +26 -0
  181. package/lib/typings/CamelCase.js +3 -0
  182. package/lib/typings/CamelCase.js.map +1 -0
  183. package/lib/typings/ClassProperties.d.ts +14 -0
  184. package/lib/typings/ClassProperties.js +3 -0
  185. package/lib/typings/ClassProperties.js.map +1 -0
  186. package/lib/typings/OmitNever.d.ts +11 -0
  187. package/lib/typings/OmitNever.js +3 -0
  188. package/lib/typings/OmitNever.js.map +1 -0
  189. package/lib/typings/PascalCase.d.ts +25 -0
  190. package/lib/typings/PascalCase.js +3 -0
  191. package/lib/typings/PascalCase.js.map +1 -0
  192. package/lib/typings/Primitive.d.ts +29 -0
  193. package/lib/typings/Primitive.js +3 -0
  194. package/lib/typings/Primitive.js.map +1 -0
  195. package/lib/typings/ProtobufAtomic.d.ts +15 -0
  196. package/lib/typings/ProtobufAtomic.js +3 -0
  197. package/lib/typings/ProtobufAtomic.js.map +1 -0
  198. package/lib/typings/Resolved.d.ts +23 -0
  199. package/lib/typings/Resolved.js +3 -0
  200. package/lib/typings/Resolved.js.map +1 -0
  201. package/lib/typings/SnakeCase.d.ts +31 -0
  202. package/lib/typings/SnakeCase.js +3 -0
  203. package/lib/typings/SnakeCase.js.map +1 -0
  204. package/lib/typings/SpecialFields.d.ts +13 -0
  205. package/lib/typings/SpecialFields.js +3 -0
  206. package/lib/typings/SpecialFields.js.map +1 -0
  207. package/lib/typings/ValidationPipe.d.ts +18 -0
  208. package/lib/typings/ValidationPipe.js +3 -0
  209. package/lib/typings/ValidationPipe.js.map +1 -0
  210. package/lib/typings/index.d.ts +12 -0
  211. package/lib/typings/index.js +29 -0
  212. package/lib/typings/index.js.map +1 -0
  213. package/lib/typings/internal/Equal.d.ts +11 -0
  214. package/lib/typings/internal/Equal.js +3 -0
  215. package/lib/typings/internal/Equal.js.map +1 -0
  216. package/lib/typings/internal/IsTuple.d.ts +13 -0
  217. package/lib/typings/internal/IsTuple.js +3 -0
  218. package/lib/typings/internal/IsTuple.js.map +1 -0
  219. package/lib/typings/internal/NativeClass.d.ts +9 -0
  220. package/lib/typings/internal/NativeClass.js +3 -0
  221. package/lib/typings/internal/NativeClass.js.map +1 -0
  222. package/lib/typings/internal/ValueOf.d.ts +15 -0
  223. package/lib/typings/internal/ValueOf.js +3 -0
  224. package/lib/typings/internal/ValueOf.js.map +1 -0
  225. package/lib/utils/IRandomGenerator.d.ts +68 -0
  226. package/lib/utils/IRandomGenerator.js +3 -0
  227. package/lib/utils/IRandomGenerator.js.map +1 -0
  228. package/lib/utils/IReadableURLSearchParams.d.ts +22 -0
  229. package/lib/utils/IReadableURLSearchParams.js +3 -0
  230. package/lib/utils/IReadableURLSearchParams.js.map +1 -0
  231. package/lib/utils/index.d.ts +2 -0
  232. package/lib/utils/index.js +19 -0
  233. package/lib/utils/index.js.map +1 -0
  234. package/package.json +79 -0
  235. package/src/http/IHttpConnection.ts +200 -0
  236. package/src/http/IHttpLlmApplication.ts +83 -0
  237. package/src/http/IHttpLlmController.ts +96 -0
  238. package/src/http/IHttpLlmFunction.ts +93 -0
  239. package/src/http/IHttpMigrateApplication.ts +48 -0
  240. package/src/http/IHttpMigrateRoute.ts +165 -0
  241. package/src/http/IHttpResponse.ts +42 -0
  242. package/src/http/index.ts +7 -0
  243. package/src/index.ts +9 -0
  244. package/src/metadata/IJsDocTagInfo.ts +25 -0
  245. package/src/metadata/IMetadataComponents.ts +24 -0
  246. package/src/metadata/IMetadataSchema.ts +293 -0
  247. package/src/metadata/IMetadataSchemaCollection.ts +20 -0
  248. package/src/metadata/IMetadataSchemaUnit.ts +20 -0
  249. package/src/metadata/IMetadataTypeTag.ts +39 -0
  250. package/src/metadata/index.ts +6 -0
  251. package/src/openapi/OpenApi.ts +643 -0
  252. package/src/openapi/OpenApiV3.ts +655 -0
  253. package/src/openapi/OpenApiV3_1.ts +735 -0
  254. package/src/openapi/SwaggerV2.ts +559 -0
  255. package/src/openapi/index.ts +4 -0
  256. package/src/protobuf/ProtobufWire.ts +51 -0
  257. package/src/protobuf/index.ts +1 -0
  258. package/src/schema/IJsonSchemaApplication.ts +274 -0
  259. package/src/schema/IJsonSchemaAttribute.ts +158 -0
  260. package/src/schema/IJsonSchemaCollection.ts +123 -0
  261. package/src/schema/IJsonSchemaTransformError.ts +86 -0
  262. package/src/schema/IJsonSchemaUnit.ts +120 -0
  263. package/src/schema/ILlmApplication.ts +103 -0
  264. package/src/schema/ILlmController.ts +57 -0
  265. package/src/schema/ILlmFunction.ts +144 -0
  266. package/src/schema/ILlmSchema.ts +484 -0
  267. package/src/schema/IResult.ts +84 -0
  268. package/src/schema/IValidation.ts +134 -0
  269. package/src/schema/index.ts +13 -0
  270. package/src/tags/Constant.ts +49 -0
  271. package/src/tags/ContentMediaType.ts +40 -0
  272. package/src/tags/Default.ts +50 -0
  273. package/src/tags/Example.ts +48 -0
  274. package/src/tags/Examples.ts +50 -0
  275. package/src/tags/ExclusiveMaximum.ts +46 -0
  276. package/src/tags/ExclusiveMinimum.ts +46 -0
  277. package/src/tags/Format.ts +76 -0
  278. package/src/tags/JsonSchemaPlugin.ts +45 -0
  279. package/src/tags/MaxItems.ts +39 -0
  280. package/src/tags/MaxLength.ts +37 -0
  281. package/src/tags/Maximum.ts +44 -0
  282. package/src/tags/MinItems.ts +39 -0
  283. package/src/tags/MinLength.ts +37 -0
  284. package/src/tags/Minimum.ts +44 -0
  285. package/src/tags/MultipleOf.ts +54 -0
  286. package/src/tags/Pattern.ts +59 -0
  287. package/src/tags/Sequence.ts +43 -0
  288. package/src/tags/TagBase.ts +131 -0
  289. package/src/tags/Type.ts +70 -0
  290. package/src/tags/UniqueItems.ts +44 -0
  291. package/src/tags/index.ts +21 -0
  292. package/src/typings/AssertionGuard.ts +12 -0
  293. package/src/typings/Atomic.ts +21 -0
  294. package/src/typings/CamelCase.ts +75 -0
  295. package/src/typings/ClassProperties.ts +15 -0
  296. package/src/typings/OmitNever.ts +12 -0
  297. package/src/typings/PascalCase.ts +71 -0
  298. package/src/typings/Primitive.ts +71 -0
  299. package/src/typings/ProtobufAtomic.ts +30 -0
  300. package/src/typings/Resolved.ts +58 -0
  301. package/src/typings/SnakeCase.ts +126 -0
  302. package/src/typings/SpecialFields.ts +13 -0
  303. package/src/typings/ValidationPipe.ts +20 -0
  304. package/src/typings/index.ts +13 -0
  305. package/src/typings/internal/Equal.ts +14 -0
  306. package/src/typings/internal/IsTuple.ts +17 -0
  307. package/src/typings/internal/NativeClass.ts +31 -0
  308. package/src/typings/internal/ValueOf.ts +29 -0
  309. package/src/utils/IRandomGenerator.ts +105 -0
  310. package/src/utils/IReadableURLSearchParams.ts +25 -0
  311. package/src/utils/index.ts +2 -0
@@ -0,0 +1,49 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Documentation metadata for literal/constant values.
5
+ *
6
+ * `Constant<Value, Content>` enhances literal type values with human-readable
7
+ * documentation that appears in generated JSON Schema output. This is useful
8
+ * for enum-like values where each literal needs individual documentation.
9
+ *
10
+ * Unlike TypeScript enums which lose their documentation in schema generation,
11
+ * `Constant` preserves title and description for each value. This helps API
12
+ * consumers understand the meaning of each allowed value.
13
+ *
14
+ * The tag itself doesn't perform validation - it only adds metadata. The
15
+ * literal type constraint is enforced by TypeScript's type system.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * type OrderStatus =
20
+ * | Constant<
21
+ * "pending",
22
+ * { title: "Pending"; description: "Order placed" }
23
+ * >
24
+ * | Constant<"shipped", { title: "Shipped"; description: "In transit" }>
25
+ * | Constant<
26
+ * "delivered",
27
+ * { title: "Delivered"; description: "Complete" }
28
+ * >;
29
+ *
30
+ * interface Order {
31
+ * status: OrderStatus;
32
+ * }
33
+ *
34
+ * @template Value The literal value (boolean, number, string, or bigint)
35
+ * @template Content Object with optional `title` and `description` properties
36
+ */
37
+ export type Constant<
38
+ Value extends boolean | number | string | bigint,
39
+ Content extends {
40
+ title?: string | undefined;
41
+ description?: string | undefined;
42
+ },
43
+ > = Value &
44
+ TagBase<{
45
+ target: "string" | "boolean" | "number" | "bigint";
46
+ kind: "constant";
47
+ value: undefined;
48
+ schema: Content;
49
+ }>;
@@ -0,0 +1,40 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * MIME type metadata for string content.
5
+ *
6
+ * `ContentMediaType<Type>` is a type tag that documents the media type of
7
+ * string content. This is metadata-only - no runtime validation is performed.
8
+ * The information appears in generated JSON Schema output.
9
+ *
10
+ * This is useful when a string property contains encoded binary data or
11
+ * structured content that should be interpreted according to a specific media
12
+ * type, such as base64-encoded images or embedded JSON.
13
+ *
14
+ * Common MIME types:
15
+ *
16
+ * - `"application/json"`: JSON data as string
17
+ * - `"application/xml"`: XML data as string
18
+ * - `"image/png"`: Base64-encoded PNG image
19
+ * - `"image/jpeg"`: Base64-encoded JPEG image
20
+ * - `"application/octet-stream"`: Generic binary data
21
+ *
22
+ * @author Jeongho Nam - https://github.com/samchon
23
+ * @example
24
+ * interface Document {
25
+ * // Base64-encoded PNG image
26
+ * thumbnail: string & ContentMediaType<"image/png">;
27
+ * // JSON stored as string
28
+ * metadata: string & ContentMediaType<"application/json">;
29
+ * }
30
+ *
31
+ * @template Value MIME type string literal
32
+ */
33
+ export type ContentMediaType<Value extends string> = TagBase<{
34
+ target: "string";
35
+ kind: "contentMediaType";
36
+ value: undefined;
37
+ schema: {
38
+ contentMediaType: Value;
39
+ };
40
+ }>;
@@ -0,0 +1,50 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Default value metadata for JSON Schema generation.
5
+ *
6
+ * `Default<Value>` is a type tag that specifies a default value for a property
7
+ * in the generated JSON Schema. This is metadata-only - typia does not
8
+ * automatically apply default values at runtime.
9
+ *
10
+ * The default value appears in the `default` field of the JSON Schema output,
11
+ * which API documentation tools and code generators can use to show default
12
+ * values or generate code that applies them.
13
+ *
14
+ * Only primitive literal types are supported: `boolean`, `bigint`, `number`,
15
+ * and `string`. For complex defaults, consider using optional properties with
16
+ * runtime default assignment.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @example
20
+ * interface Config {
21
+ * // Default to 10 items per page
22
+ * pageSize: (number & Default<10>) | undefined;
23
+ * // Default to enabled
24
+ * enabled: (boolean & Default<true>) | undefined;
25
+ * // Default sort order
26
+ * sortOrder: (string & Default<"asc">) | undefined;
27
+ * }
28
+ *
29
+ * @template Value The default value literal (must be a primitive)
30
+ */
31
+ export type Default<Value extends boolean | bigint | number | string> =
32
+ TagBase<{
33
+ target: Value extends boolean
34
+ ? "boolean"
35
+ : Value extends bigint
36
+ ? "bigint"
37
+ : Value extends number
38
+ ? "number"
39
+ : "string";
40
+ kind: "default";
41
+ value: Value;
42
+ exclusive: true;
43
+ schema: Value extends bigint
44
+ ? { default: Numeric<Value> }
45
+ : { default: Value };
46
+ }>;
47
+
48
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
49
+ ? N
50
+ : never;
@@ -0,0 +1,48 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Single example value for JSON Schema documentation.
5
+ *
6
+ * `Example<Value>` is a type tag that adds a representative example value to
7
+ * the generated JSON Schema. This is metadata-only - it appears in the
8
+ * `example` field of the schema and helps API consumers understand expected
9
+ * values.
10
+ *
11
+ * Examples are displayed in API documentation tools like Swagger UI and can be
12
+ * used by code generators to produce more helpful client code.
13
+ *
14
+ * Supports all JSON-compatible types: primitives, objects, arrays, and null.
15
+ * For multiple named examples, use {@link Examples} instead.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface User {
20
+ * email: string & Format<"email"> & Example<"user@example.com">;
21
+ * age: number & Minimum<0> & Example<25>;
22
+ * tags: string[] & Example<["admin", "active"]>;
23
+ * }
24
+ *
25
+ * @template Value The example value (any JSON-compatible type)
26
+ */
27
+ export type Example<
28
+ Value extends
29
+ | boolean
30
+ | bigint
31
+ | number
32
+ | string
33
+ | object
34
+ | Array<unknown>
35
+ | null,
36
+ > = TagBase<{
37
+ target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
38
+ kind: "example";
39
+ value: Value;
40
+ exclusive: true;
41
+ schema: Value extends bigint
42
+ ? { example: Numeric<Value> }
43
+ : { example: Value };
44
+ }>;
45
+
46
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
47
+ ? N
48
+ : never;
@@ -0,0 +1,50 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Multiple named examples for JSON Schema documentation.
5
+ *
6
+ * `Examples<Record>` is a type tag that adds multiple labeled example values to
7
+ * the generated JSON Schema. Each example has a name and a value, providing
8
+ * rich documentation for different use cases or scenarios.
9
+ *
10
+ * This is useful when a property can have various valid values and you want to
11
+ * illustrate multiple possibilities, such as different user types, edge cases,
12
+ * or common configurations.
13
+ *
14
+ * The examples appear in the `examples` field of the JSON Schema and are
15
+ * displayed by API documentation tools. For a single unnamed example, use
16
+ * {@link Example} instead.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @example
20
+ * interface Product {
21
+ * price: number &
22
+ * Examples<{
23
+ * budget: 9.99;
24
+ * premium: 99.99;
25
+ * enterprise: 999.99;
26
+ * }>;
27
+ * status: string &
28
+ * Examples<{
29
+ * active: "active";
30
+ * discontinued: "discontinued";
31
+ * preorder: "preorder";
32
+ * }>;
33
+ * }
34
+ *
35
+ * @template Value Record mapping example names to their values
36
+ */
37
+ export type Examples<
38
+ Value extends Record<
39
+ string,
40
+ boolean | bigint | number | string | object | Array<unknown> | null
41
+ >,
42
+ > = TagBase<{
43
+ target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
44
+ kind: "examples";
45
+ value: Value;
46
+ exclusive: true;
47
+ schema: {
48
+ examples: Value;
49
+ };
50
+ }>;
@@ -0,0 +1,46 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Exclusive maximum value constraint (value < max).
5
+ *
6
+ * `ExclusiveMaximum<N>` is a type tag that validates numeric values are
7
+ * strictly less than the specified bound (not equal). Apply it to `number` or
8
+ * `bigint` properties using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link Maximum} - you cannot
11
+ * use both on the same property. Use `ExclusiveMaximum` for exclusive bounds
12
+ * (<) and `Maximum` for inclusive bounds (<=).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `exclusiveMaximum` in JSON Schema.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Temperature {
20
+ * // Must be less than 100 (boiling point), not equal
21
+ * celsius: number & ExclusiveMaximum<100>;
22
+ * }
23
+ *
24
+ * @template Value The maximum bound (exclusive - value must be less)
25
+ */
26
+ export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
27
+ target: Value extends bigint ? "bigint" : "number";
28
+ kind: "exclusiveMaximum";
29
+ value: Value;
30
+ validate: `$input < ${Cast<Value>}`;
31
+ exclusive: ["exclusiveMaximum", "maximum"];
32
+ schema: Value extends bigint
33
+ ? {
34
+ exclusiveMaximum: Numeric<Value>;
35
+ }
36
+ : {
37
+ exclusiveMaximum: Value;
38
+ };
39
+ }>;
40
+
41
+ type Cast<Value extends number | bigint> = Value extends number
42
+ ? Value
43
+ : `BigInt(${Value})`;
44
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
+ ? N
46
+ : never;
@@ -0,0 +1,46 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Exclusive minimum value constraint (value > min).
5
+ *
6
+ * `ExclusiveMinimum<N>` is a type tag that validates numeric values are
7
+ * strictly greater than the specified bound (not equal). Apply it to `number`
8
+ * or `bigint` properties using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link Minimum} - you cannot
11
+ * use both on the same property. Use `ExclusiveMinimum` for exclusive bounds
12
+ * (>) and `Minimum` for inclusive bounds (>=).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `exclusiveMinimum` in JSON Schema.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface PositiveNumber {
20
+ * // Must be greater than 0, not equal to 0
21
+ * value: number & ExclusiveMinimum<0>;
22
+ * }
23
+ *
24
+ * @template Value The minimum bound (exclusive - value must be greater)
25
+ */
26
+ export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
27
+ target: Value extends bigint ? "bigint" : "number";
28
+ kind: "exclusiveMinimum";
29
+ value: Value;
30
+ validate: `${Cast<Value>} < $input`;
31
+ exclusive: ["exclusiveMinimum", "minimum"];
32
+ schema: Value extends bigint
33
+ ? {
34
+ exclusiveMinimum: Numeric<Value>;
35
+ }
36
+ : {
37
+ exclusiveMinimum: Value;
38
+ };
39
+ }>;
40
+
41
+ type Cast<Value extends number | bigint> = Value extends number
42
+ ? Value
43
+ : `BigInt(${Value})`;
44
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
+ ? N
46
+ : never;
@@ -0,0 +1,76 @@
1
+ import type { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String format validation constraint.
5
+ *
6
+ * `Format<Value>` validates strings against predefined formats (email, uuid,
7
+ * url, date-time, etc.). Mutually exclusive with {@link Pattern}.
8
+ *
9
+ * @author Jeongho Nam - https://github.com/samchon
10
+ * @template Value Format identifier (see {@link Format.Value} for options)
11
+ */
12
+ export type Format<Value extends Format.Value> = TagBase<{
13
+ target: "string";
14
+ kind: "format";
15
+ value: Value;
16
+ validate: `$importInternal("isFormat${PascalizeString<Value>}")($input)`;
17
+ exclusive: ["format", "pattern"];
18
+ schema: {
19
+ format: Value;
20
+ };
21
+ }>;
22
+ export namespace Format {
23
+ /**
24
+ * Supported format identifiers.
25
+ *
26
+ * Standard JSON Schema formats:
27
+ *
28
+ * - `email`, `idn-email`: Email addresses
29
+ * - `hostname`, `idn-hostname`: Hostnames
30
+ * - `uri`, `uri-reference`, `uri-template`, `url`: URLs
31
+ * - `iri`, `iri-reference`: Internationalized URLs
32
+ * - `uuid`: UUID strings
33
+ * - `ipv4`, `ipv6`: IP addresses
34
+ * - `date-time`, `date`, `time`, `duration`: Date/time formats
35
+ * - `json-pointer`, `relative-json-pointer`: JSON pointers
36
+ * - `regex`: Regular expression patterns
37
+ * - `byte`: Base64-encoded data
38
+ * - `password`: Password fields (for documentation only)
39
+ */
40
+ export type Value =
41
+ | "byte"
42
+ | "password"
43
+ | "regex"
44
+ | "uuid"
45
+ | "email"
46
+ | "hostname"
47
+ | "idn-email"
48
+ | "idn-hostname"
49
+ | "iri"
50
+ | "iri-reference"
51
+ | "ipv4"
52
+ | "ipv6"
53
+ | "uri"
54
+ | "uri-reference"
55
+ | "uri-template"
56
+ | "url"
57
+ | "date-time"
58
+ | "date"
59
+ | "time"
60
+ | "duration"
61
+ | "json-pointer"
62
+ | "relative-json-pointer";
63
+ }
64
+
65
+ type PascalizeString<Key extends string> = Key extends `-${infer R}`
66
+ ? `${PascalizeString<R>}`
67
+ : Key extends `${infer _F}-${infer _R}`
68
+ ? PascalizeSnakeString<Key>
69
+ : Capitalize<Key>;
70
+ type PascalizeSnakeString<Key extends string> = Key extends `-${infer R}`
71
+ ? PascalizeSnakeString<R>
72
+ : Key extends `${infer F}${infer M}-${infer R}`
73
+ ? `${Uppercase<F>}${Lowercase<M>}${PascalizeSnakeString<R>}`
74
+ : Key extends `${infer F}${infer R}`
75
+ ? `${Uppercase<F>}${Lowercase<R>}`
76
+ : Key;
@@ -0,0 +1,45 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Injects custom properties into generated JSON Schema.
5
+ *
6
+ * `JsonSchemaPlugin<Schema>` is a type tag that merges custom properties into
7
+ * the generated JSON Schema output. This enables vendor extensions (typically
8
+ * prefixed with `x-`) and custom metadata that tools in your ecosystem may
9
+ * require.
10
+ *
11
+ * This is metadata-only - it does not affect runtime validation. The properties
12
+ * are simply merged into the schema for the annotated type.
13
+ *
14
+ * Common use cases:
15
+ *
16
+ * - OpenAPI vendor extensions (`x-*` properties)
17
+ * - Custom UI hints for form generators
18
+ * - Tool-specific metadata
19
+ * - Integration with third-party schema consumers
20
+ *
21
+ * @author Jeongho Nam - https://github.com/samchon
22
+ * @example
23
+ * interface FormField {
24
+ * // Add custom UI hints for form generation
25
+ * email: string &
26
+ * Format<"email"> &
27
+ * JsonSchemaPlugin<{
28
+ * "x-ui-widget": "email-input";
29
+ * "x-ui-placeholder": "Enter your email";
30
+ * }>;
31
+ * // Add custom sorting metadata
32
+ * priority: number &
33
+ * JsonSchemaPlugin<{
34
+ * "x-sort-order": "descending";
35
+ * }>;
36
+ * }
37
+ *
38
+ * @template Schema Object type containing the custom properties to merge
39
+ */
40
+ export type JsonSchemaPlugin<Schema extends object> = TagBase<{
41
+ target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
42
+ kind: "jsonPlugin";
43
+ value: undefined;
44
+ schema: Schema;
45
+ }>;
@@ -0,0 +1,39 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Array maximum items constraint.
5
+ *
6
+ * `MaxItems<N>` is a type tag that validates array values have at most the
7
+ * specified number of elements. Apply it to array properties using TypeScript
8
+ * intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MinItems} to define a valid
11
+ * size range. It can also be combined with {@link UniqueItems} to require unique
12
+ * elements.
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `maxItems` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Upload {
20
+ * // Maximum 5 files per upload
21
+ * files: (File & MaxItems<5>)[];
22
+ * }
23
+ * interface Config {
24
+ * // Between 1-3 backup servers allowed
25
+ * backupServers: (Server & MinItems<1> & MaxItems<3>)[];
26
+ * }
27
+ *
28
+ * @template Value Maximum number of elements allowed
29
+ */
30
+ export type MaxItems<Value extends number> = TagBase<{
31
+ target: "array";
32
+ kind: "maxItems";
33
+ value: Value;
34
+ validate: `$input.length <= ${Value}`;
35
+ exclusive: true;
36
+ schema: {
37
+ maxItems: Value;
38
+ };
39
+ }>;
@@ -0,0 +1,37 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String maximum length constraint.
5
+ *
6
+ * `MaxLength<N>` is a type tag that validates string values have at most the
7
+ * specified number of characters. Apply it to `string` properties using
8
+ * TypeScript intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MinLength} to define a valid
11
+ * length range. Multiple length constraints can be applied to the same property
12
+ * (all must pass).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `maxLength` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Article {
20
+ * // Title limited to 100 characters
21
+ * title: string & MaxLength<100>;
22
+ * // Description between 10-500 characters
23
+ * description: string & MinLength<10> & MaxLength<500>;
24
+ * }
25
+ *
26
+ * @template Value Maximum number of characters allowed
27
+ */
28
+ export type MaxLength<Value extends number> = TagBase<{
29
+ target: "string";
30
+ kind: "maxLength";
31
+ value: Value;
32
+ validate: `$input.length <= ${Value}`;
33
+ exclusive: true;
34
+ schema: {
35
+ maxLength: Value;
36
+ };
37
+ }>;
@@ -0,0 +1,44 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Inclusive maximum value constraint (value <= max).
5
+ *
6
+ * `Maximum<N>` is a type tag that validates numeric values are less than or
7
+ * equal to the specified bound. Apply it to `number` or `bigint` properties
8
+ * using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link ExclusiveMaximum} - you
11
+ * cannot use both on the same property. Use `Maximum` for inclusive bounds (<=)
12
+ * and `ExclusiveMaximum` for exclusive bounds (<).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `maximum` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Rating {
20
+ * // Score from 0-100
21
+ * score: number & Minimum<0> & Maximum<100>;
22
+ * // Percentage cannot exceed 1.0
23
+ * ratio: number & Maximum<1.0>;
24
+ * }
25
+ *
26
+ * @template Value The maximum allowed value (inclusive)
27
+ */
28
+ export type Maximum<Value extends number | bigint> = TagBase<{
29
+ target: Value extends bigint ? "bigint" : "number";
30
+ kind: "maximum";
31
+ value: Value;
32
+ validate: `$input <= ${Cast<Value>}`;
33
+ exclusive: ["maximum", "exclusiveMaximum"];
34
+ schema: Value extends bigint
35
+ ? { maximum: Numeric<Value> }
36
+ : { maximum: Value };
37
+ }>;
38
+
39
+ type Cast<Value extends number | bigint> = Value extends number
40
+ ? Value
41
+ : `BigInt(${Value})`;
42
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
43
+ ? N
44
+ : never;
@@ -0,0 +1,39 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Array minimum items constraint.
5
+ *
6
+ * `MinItems<N>` is a type tag that validates array values have at least the
7
+ * specified number of elements. Apply it to array properties using TypeScript
8
+ * intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MaxItems} to define a valid
11
+ * size range. It can also be combined with {@link UniqueItems} to require unique
12
+ * elements.
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `minItems` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Order {
20
+ * // Must have at least 1 item
21
+ * items: (Product & MinItems<1>)[];
22
+ * }
23
+ * interface Team {
24
+ * // Team must have 2-10 members
25
+ * members: (User & MinItems<2> & MaxItems<10>)[];
26
+ * }
27
+ *
28
+ * @template Value Minimum number of elements required
29
+ */
30
+ export type MinItems<Value extends number> = TagBase<{
31
+ target: "array";
32
+ kind: "minItems";
33
+ value: Value;
34
+ validate: `${Value} <= $input.length`;
35
+ exclusive: true;
36
+ schema: {
37
+ minItems: Value;
38
+ };
39
+ }>;
@@ -0,0 +1,37 @@
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String minimum length constraint.
5
+ *
6
+ * `MinLength<N>` is a type tag that validates string values have at least the
7
+ * specified number of characters. Apply it to `string` properties using
8
+ * TypeScript intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MaxLength} to define a valid
11
+ * length range. Multiple length constraints can be applied to the same property
12
+ * (all must pass).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `minLength` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface User {
20
+ * // Username must be at least 3 characters
21
+ * username: string & MinLength<3> & MaxLength<20>;
22
+ * // Password must be at least 8 characters
23
+ * password: string & MinLength<8>;
24
+ * }
25
+ *
26
+ * @template Value Minimum number of characters required
27
+ */
28
+ export type MinLength<Value extends number> = TagBase<{
29
+ target: "string";
30
+ kind: "minLength";
31
+ value: Value;
32
+ validate: `${Value} <= $input.length`;
33
+ exclusive: true;
34
+ schema: {
35
+ minLength: Value;
36
+ };
37
+ }>;