@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,412 @@
1
+ import { tags } from "../index";
2
+ import { IJsonSchemaAttribute } from "./IJsonSchemaAttribute";
3
+ /**
4
+ * Type schema for LLM function calling.
5
+ *
6
+ * `ILlmSchema` is a JSON Schema subset designed for LLM function calling
7
+ * compatibility. Most LLMs (OpenAI GPT, Anthropic Claude, Google Gemini, etc.)
8
+ * do not fully support JSON Schema, so this simplified schema omits unsupported
9
+ * features like tuples, `const`, and mixed union types.
10
+ *
11
+ * Generated by `typia.llm.schema<T>()` for single types or included in
12
+ * {@link ILlmApplication} via `typia.llm.application<Class>()`. Shared type
13
+ * definitions use `$defs` with `$ref` references to reduce duplication and
14
+ * handle recursive structures.
15
+ *
16
+ * Set {@link ILlmSchema.IConfig.strict} to `true` for OpenAI's structured output
17
+ * mode, which requires all properties to be `required` and
18
+ * `additionalProperties: false`.
19
+ *
20
+ * @author Jeongho Nam - https://github.com/samchon
21
+ */
22
+ export type ILlmSchema = ILlmSchema.IBoolean | ILlmSchema.IInteger | ILlmSchema.INumber | ILlmSchema.IString | ILlmSchema.IArray | ILlmSchema.IObject | ILlmSchema.IReference | ILlmSchema.IAnyOf | ILlmSchema.INull | ILlmSchema.IUnknown;
23
+ export declare namespace ILlmSchema {
24
+ /**
25
+ * Configuration options for LLM schema generation.
26
+ *
27
+ * Controls how TypeScript types are converted to LLM-compatible JSON schemas.
28
+ * These settings affect reference handling and OpenAI structured output
29
+ * compatibility.
30
+ */
31
+ interface IConfig {
32
+ /**
33
+ * Whether to allow `$ref` references everywhere.
34
+ *
35
+ * When `false`, references are inlined except for recursive types.
36
+ * References reduce token cost but may cause hallucination.
37
+ *
38
+ * @default true
39
+ */
40
+ reference: boolean;
41
+ /**
42
+ * Whether to enable strict mode (OpenAI structured output).
43
+ *
44
+ * When `true`, all properties become required and `additionalProperties` is
45
+ * forced to `false`.
46
+ *
47
+ * @default false
48
+ */
49
+ strict: boolean;
50
+ }
51
+ /**
52
+ * Function parameters schema with shared type definitions.
53
+ *
54
+ * Extends the object schema to include a `$defs` map for named type
55
+ * definitions that can be referenced via `$ref`. This structure allows
56
+ * recursive types and reduces schema duplication.
57
+ *
58
+ * The `additionalProperties` is always `false` for parameters to ensure
59
+ * strict argument validation and prevent unexpected properties.
60
+ */
61
+ interface IParameters extends Omit<IObject, "additionalProperties"> {
62
+ /**
63
+ * Named schema definitions for reference.
64
+ *
65
+ * Contains type definitions that can be referenced throughout the schema
66
+ * using `$ref: "#/$defs/TypeName"`. Essential for recursive types and
67
+ * shared structures.
68
+ */
69
+ $defs: Record<string, ILlmSchema>;
70
+ /**
71
+ * Whether additional properties are allowed.
72
+ *
73
+ * Always `false` for function parameters to ensure strict type checking.
74
+ * This prevents LLMs from hallucinating extra properties.
75
+ */
76
+ additionalProperties: false;
77
+ }
78
+ /**
79
+ * Boolean type schema.
80
+ *
81
+ * Represents a JSON Schema boolean type with optional enum constraints and
82
+ * default value. Used for true/false parameters and flags.
83
+ */
84
+ interface IBoolean extends IJsonSchemaAttribute.IBoolean {
85
+ /**
86
+ * Allowed boolean values.
87
+ *
88
+ * Restricts the value to specific boolean literals. Typically unused since
89
+ * booleans only have two possible values, but supported for consistency
90
+ * with other types.
91
+ */
92
+ enum?: Array<boolean>;
93
+ /**
94
+ * Default value when not provided.
95
+ *
96
+ * The boolean value to use when the LLM omits this parameter.
97
+ */
98
+ default?: boolean;
99
+ }
100
+ /**
101
+ * Integer type schema.
102
+ *
103
+ * Represents a JSON Schema integer type with numeric constraints. Maps to
104
+ * TypeScript `number` with integer validation. Supports range constraints,
105
+ * enum restrictions, and divisibility checks.
106
+ */
107
+ interface IInteger extends IJsonSchemaAttribute.IInteger {
108
+ /**
109
+ * Allowed integer values.
110
+ *
111
+ * Restricts the value to specific integer literals. Useful for representing
112
+ * enum-like integer codes or limited value sets.
113
+ */
114
+ enum?: Array<number & tags.Type<"int64">>;
115
+ /**
116
+ * Default value when not provided.
117
+ *
118
+ * The integer value to use when the LLM omits this parameter.
119
+ */
120
+ default?: number & tags.Type<"int64">;
121
+ /**
122
+ * Minimum value (inclusive).
123
+ *
124
+ * The value must be greater than or equal to this number.
125
+ */
126
+ minimum?: number & tags.Type<"int64">;
127
+ /**
128
+ * Maximum value (inclusive).
129
+ *
130
+ * The value must be less than or equal to this number.
131
+ */
132
+ maximum?: number & tags.Type<"int64">;
133
+ /**
134
+ * Exclusive minimum value.
135
+ *
136
+ * The value must be strictly greater than this number.
137
+ */
138
+ exclusiveMinimum?: number & tags.Type<"int64">;
139
+ /**
140
+ * Exclusive maximum value.
141
+ *
142
+ * The value must be strictly less than this number.
143
+ */
144
+ exclusiveMaximum?: number & tags.Type<"int64">;
145
+ /**
146
+ * Value must be divisible by this number.
147
+ *
148
+ * Used for constraints like "must be even" (multipleOf: 2) or "must be a
149
+ * multiple of 100" (multipleOf: 100).
150
+ */
151
+ multipleOf?: number & tags.Type<"uint64"> & tags.ExclusiveMinimum<0>;
152
+ }
153
+ /**
154
+ * Number (floating-point) type schema.
155
+ *
156
+ * Represents a JSON Schema number type for floating-point values. Maps to
157
+ * TypeScript `number` type. Supports range constraints, enum restrictions,
158
+ * and precision checks via multipleOf.
159
+ */
160
+ interface INumber extends IJsonSchemaAttribute.INumber {
161
+ /**
162
+ * Allowed numeric values.
163
+ *
164
+ * Restricts the value to specific number literals. Useful for representing
165
+ * specific valid values like percentages or rates.
166
+ */
167
+ enum?: Array<number>;
168
+ /**
169
+ * Default value when not provided.
170
+ *
171
+ * The number to use when the LLM omits this parameter.
172
+ */
173
+ default?: number;
174
+ /**
175
+ * Minimum value (inclusive).
176
+ *
177
+ * The value must be greater than or equal to this number.
178
+ */
179
+ minimum?: number;
180
+ /**
181
+ * Maximum value (inclusive).
182
+ *
183
+ * The value must be less than or equal to this number.
184
+ */
185
+ maximum?: number;
186
+ /**
187
+ * Exclusive minimum value.
188
+ *
189
+ * The value must be strictly greater than this number.
190
+ */
191
+ exclusiveMinimum?: number;
192
+ /**
193
+ * Exclusive maximum value.
194
+ *
195
+ * The value must be strictly less than this number.
196
+ */
197
+ exclusiveMaximum?: number;
198
+ /**
199
+ * Value must be divisible by this number.
200
+ *
201
+ * Useful for decimal precision constraints like "two decimal places"
202
+ * (multipleOf: 0.01) or currency amounts (multipleOf: 0.01).
203
+ */
204
+ multipleOf?: number & tags.ExclusiveMinimum<0>;
205
+ }
206
+ /**
207
+ * String type schema.
208
+ *
209
+ * Represents a JSON Schema string type with format validation, pattern
210
+ * matching, and length constraints. Maps to TypeScript `string` type with
211
+ * optional semantic format annotations.
212
+ */
213
+ interface IString extends IJsonSchemaAttribute.IString {
214
+ /**
215
+ * Allowed string values.
216
+ *
217
+ * Restricts the value to specific string literals. Maps directly to
218
+ * TypeScript string literal union types.
219
+ */
220
+ enum?: Array<string>;
221
+ /**
222
+ * Default value when not provided.
223
+ *
224
+ * The string to use when the LLM omits this parameter.
225
+ */
226
+ default?: string;
227
+ /**
228
+ * Semantic format specifier.
229
+ *
230
+ * Indicates the string represents a specific format like email, UUID, or
231
+ * date-time. LLMs may use this to generate appropriate values. Common
232
+ * formats include "email", "uri", "uuid", "date-time".
233
+ */
234
+ format?: "binary" | "byte" | "password" | "regex" | "uuid" | "email" | "hostname" | "idn-email" | "idn-hostname" | "iri" | "iri-reference" | "ipv4" | "ipv6" | "uri" | "uri-reference" | "uri-template" | "url" | "date-time" | "date" | "time" | "duration" | "json-pointer" | "relative-json-pointer" | (string & {});
235
+ /**
236
+ * Regular expression pattern for validation.
237
+ *
238
+ * The string must match this regex pattern. Note that LLMs may struggle
239
+ * with complex regex patterns; simple patterns work best.
240
+ */
241
+ pattern?: string;
242
+ /**
243
+ * MIME type of the string content.
244
+ *
245
+ * Indicates the content type when the string contains encoded binary data,
246
+ * such as "application/json" or "image/png".
247
+ */
248
+ contentMediaType?: string;
249
+ /**
250
+ * Minimum string length.
251
+ *
252
+ * The string must have at least this many characters.
253
+ */
254
+ minLength?: number & tags.Type<"uint64">;
255
+ /**
256
+ * Maximum string length.
257
+ *
258
+ * The string must have at most this many characters.
259
+ */
260
+ maxLength?: number & tags.Type<"uint64">;
261
+ }
262
+ /**
263
+ * Array type schema.
264
+ *
265
+ * Represents a JSON Schema array type with item type validation and size
266
+ * constraints. Maps to TypeScript `T[]` or `Array<T>` types. Note: Tuple
267
+ * types are not supported by LLM schemas.
268
+ */
269
+ interface IArray extends IJsonSchemaAttribute.IArray {
270
+ /**
271
+ * Schema for array elements.
272
+ *
273
+ * All elements in the array must conform to this schema. For heterogeneous
274
+ * arrays, use an `anyOf` schema.
275
+ */
276
+ items: ILlmSchema;
277
+ /**
278
+ * Whether elements must be unique.
279
+ *
280
+ * When `true`, no two elements may be equal. Maps to TypeScript `Set<T>`
281
+ * semantics but represented as an array.
282
+ */
283
+ uniqueItems?: boolean;
284
+ /**
285
+ * Minimum number of elements.
286
+ *
287
+ * The array must contain at least this many items.
288
+ */
289
+ minItems?: number & tags.Type<"uint64">;
290
+ /**
291
+ * Maximum number of elements.
292
+ *
293
+ * The array must contain at most this many items.
294
+ */
295
+ maxItems?: number & tags.Type<"uint64">;
296
+ }
297
+ /**
298
+ * Object type schema.
299
+ *
300
+ * Represents a JSON Schema object type with named properties. Maps to
301
+ * TypeScript interface or object type. Supports required property
302
+ * declarations and dynamic additional properties.
303
+ */
304
+ interface IObject extends IJsonSchemaAttribute.IObject {
305
+ /**
306
+ * Property name to schema mapping.
307
+ *
308
+ * Defines the type of each named property on the object. All properties are
309
+ * defined here regardless of whether they are required or optional.
310
+ */
311
+ properties: Record<string, ILlmSchema>;
312
+ /**
313
+ * Schema for dynamic/additional properties.
314
+ *
315
+ * - `false` (default): No additional properties allowed
316
+ * - `true`: Any additional properties allowed
317
+ * - Schema: Additional properties must match this schema
318
+ *
319
+ * Note: ChatGPT and Gemini do not support `additionalProperties`. Use
320
+ * {@link ILlmSchema.IConfig.strict} mode for OpenAI compatibility.
321
+ */
322
+ additionalProperties?: ILlmSchema | boolean;
323
+ /**
324
+ * List of required property names.
325
+ *
326
+ * Properties in this array must be present in the object. In strict mode,
327
+ * all properties become required automatically.
328
+ */
329
+ required: string[];
330
+ }
331
+ /**
332
+ * Reference to a named schema definition.
333
+ *
334
+ * Points to a schema defined in the `$defs` map using a JSON pointer. Used to
335
+ * avoid schema duplication and enable recursive type definitions. The
336
+ * reference path format is `#/$defs/TypeName`.
337
+ */
338
+ interface IReference extends IJsonSchemaAttribute {
339
+ /**
340
+ * JSON pointer to the referenced schema.
341
+ *
342
+ * Must be in the format `#/$defs/TypeName` where TypeName is a key in the
343
+ * parent schema's `$defs` map.
344
+ */
345
+ $ref: string;
346
+ }
347
+ /**
348
+ * Union type schema (A | B | C).
349
+ *
350
+ * Represents a TypeScript union type where the value can match any one of the
351
+ * member schemas. Note: Gemini does not support `anyOf`/`oneOf` schemas. Use
352
+ * discriminated unions with `x-discriminator` when possible for better LLM
353
+ * comprehension.
354
+ */
355
+ interface IAnyOf extends IJsonSchemaAttribute {
356
+ /**
357
+ * Array of possible schemas.
358
+ *
359
+ * The value must match at least one of these schemas. Nested `anyOf`
360
+ * schemas are flattened to avoid deep nesting.
361
+ */
362
+ anyOf: Exclude<ILlmSchema, ILlmSchema.IAnyOf>[];
363
+ /**
364
+ * Discriminator for tagged/discriminated unions.
365
+ *
366
+ * Helps LLMs understand which variant to select based on a discriminating
367
+ * property value. Improves type inference accuracy.
368
+ */
369
+ "x-discriminator"?: IAnyOf.IDiscriminator;
370
+ }
371
+ namespace IAnyOf {
372
+ /**
373
+ * Discriminator configuration for tagged unions.
374
+ *
375
+ * Specifies which property distinguishes between union variants and maps
376
+ * discriminator values to their corresponding schemas.
377
+ */
378
+ interface IDiscriminator {
379
+ /**
380
+ * Name of the discriminating property.
381
+ *
382
+ * This property must exist on all union member object schemas and contain
383
+ * unique literal values that identify each variant.
384
+ */
385
+ propertyName: string;
386
+ /**
387
+ * Mapping from discriminator values to schema references.
388
+ *
389
+ * Keys are the literal values of the discriminator property, values are
390
+ * `$ref` paths to the corresponding schemas.
391
+ */
392
+ mapping?: Record<string, string>;
393
+ }
394
+ }
395
+ /**
396
+ * Null type schema.
397
+ *
398
+ * Represents the JSON null value. In TypeScript union types like `T | null`,
399
+ * this schema appears in an `anyOf` alongside the T schema.
400
+ */
401
+ interface INull extends IJsonSchemaAttribute.INull {
402
+ }
403
+ /**
404
+ * Unknown/any type schema.
405
+ *
406
+ * Represents TypeScript `any` or `unknown` types where no specific type
407
+ * constraint is defined. Use sparingly as LLMs may generate unexpected values
408
+ * for unconstrained types.
409
+ */
410
+ interface IUnknown extends IJsonSchemaAttribute.IUnknown {
411
+ }
412
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ILlmSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILlmSchema.js","sourceRoot":"","sources":["../../src/schema/ILlmSchema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Result type for operations that can either succeed or fail.
3
+ *
4
+ * `IResult` is a discriminated union representing the outcome of an operation
5
+ * that may fail. This pattern (often called "Result" or "Either" monad) enables
6
+ * explicit error handling without exceptions.
7
+ *
8
+ * Check the {@link IResult.success | success} discriminator to determine the
9
+ * outcome:
10
+ *
11
+ * - `true` → {@link IResult.ISuccess} with the result in
12
+ * {@link IResult.ISuccess.value | value}
13
+ * - `false` → {@link IResult.IFailure} with the error in
14
+ * {@link IResult.IFailure.error | error}
15
+ *
16
+ * This pattern is used throughout typia for safe operations like parsing and
17
+ * transformation where errors are expected possibilities.
18
+ *
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ * @example
21
+ * const result: IResult<User, ParseError> = parseUser(json);
22
+ * if (result.success) {
23
+ * console.log(result.value.name);
24
+ * } else {
25
+ * console.error(result.error.message);
26
+ * }
27
+ *
28
+ * @template T Type of the success value
29
+ * @template E Type of the error value
30
+ */
31
+ export type IResult<T, E> = IResult.ISuccess<T> | IResult.IFailure<E>;
32
+ export declare namespace IResult {
33
+ /**
34
+ * Successful result variant.
35
+ *
36
+ * Indicates the operation completed successfully and contains the result
37
+ * value. Access via {@link value} after checking {@link success} is `true`.
38
+ *
39
+ * @template T Type of the success value
40
+ */
41
+ interface ISuccess<T> {
42
+ /**
43
+ * Success discriminator.
44
+ *
45
+ * Always `true` for successful results. Use this to narrow the type before
46
+ * accessing {@link value}.
47
+ */
48
+ success: true;
49
+ /**
50
+ * The successful result value.
51
+ *
52
+ * Contains the operation's output. Only accessible when {@link success} is
53
+ * `true`.
54
+ */
55
+ value: T;
56
+ }
57
+ /**
58
+ * Failed result variant.
59
+ *
60
+ * Indicates the operation failed and contains error information. Access via
61
+ * {@link error} after checking {@link success} is `false`.
62
+ *
63
+ * @template E Type of the error value
64
+ */
65
+ interface IFailure<E> {
66
+ /**
67
+ * Success discriminator.
68
+ *
69
+ * Always `false` for failed results. Use this to narrow the type before
70
+ * accessing {@link error}.
71
+ */
72
+ success: false;
73
+ /**
74
+ * The error information.
75
+ *
76
+ * Contains details about why the operation failed. Only accessible when
77
+ * {@link success} is `false`.
78
+ */
79
+ error: E;
80
+ }
81
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IResult.js","sourceRoot":"","sources":["../../src/schema/IResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Validation result type with detailed error information.
3
+ *
4
+ * `IValidation<T>` is the return type of `typia.validate<T>()` and related
5
+ * validation functions. Unlike `typia.is<T>()` which returns a boolean, or
6
+ * `typia.assert<T>()` which throws exceptions, `typia.validate<T>()` returns
7
+ * this structured result with full error details.
8
+ *
9
+ * Check the {@link IValidation.success | success} discriminator:
10
+ *
11
+ * - `true` → {@link IValidation.ISuccess} with validated
12
+ * {@link IValidation.ISuccess.data | data}
13
+ * - `false` → {@link IValidation.IFailure} with
14
+ * {@link IValidation.IFailure.errors | errors} array
15
+ *
16
+ * This is the recommended validation function when you need to report
17
+ * validation errors to users or log them for debugging.
18
+ *
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ * @example
21
+ * const result = typia.validate<User>(input);
22
+ * if (result.success) {
23
+ * return result.data; // User type
24
+ * } else {
25
+ * result.errors.forEach((e) => console.log(e.path, e.expected));
26
+ * }
27
+ *
28
+ * @template T The expected type after successful validation
29
+ */
30
+ export type IValidation<T = unknown> = IValidation.ISuccess<T> | IValidation.IFailure;
31
+ export declare namespace IValidation {
32
+ /**
33
+ * Successful validation result.
34
+ *
35
+ * Indicates the input matches the expected type. The validated data is
36
+ * available in {@link data} with full type information.
37
+ *
38
+ * @template T The validated type
39
+ */
40
+ interface ISuccess<T = unknown> {
41
+ /**
42
+ * Success discriminator.
43
+ *
44
+ * Always `true` for successful validations. Use this to narrow the type
45
+ * before accessing {@link data}.
46
+ */
47
+ success: true;
48
+ /**
49
+ * The validated data with correct type.
50
+ *
51
+ * The original input after successful validation. TypeScript will narrow
52
+ * this to type `T` when {@link success} is `true`.
53
+ */
54
+ data: T;
55
+ }
56
+ /**
57
+ * Failed validation result with error details.
58
+ *
59
+ * Indicates the input did not match the expected type. Contains the original
60
+ * data and an array of all validation errors found.
61
+ */
62
+ interface IFailure {
63
+ /**
64
+ * Success discriminator.
65
+ *
66
+ * Always `false` for failed validations. Use this to narrow the type before
67
+ * accessing {@link errors}.
68
+ */
69
+ success: false;
70
+ /**
71
+ * The original input that failed validation.
72
+ *
73
+ * Preserved as `unknown` type since it didn't match the expected type.
74
+ * Useful for debugging or logging the actual value.
75
+ */
76
+ data: unknown;
77
+ /**
78
+ * Array of validation errors.
79
+ *
80
+ * Contains one entry for each validation failure found. Multiple errors may
81
+ * exist if the input has multiple type mismatches.
82
+ */
83
+ errors: IError[];
84
+ }
85
+ /**
86
+ * Detailed information about a single validation error.
87
+ *
88
+ * Describes exactly what went wrong during validation, including the
89
+ * location, expected type, and actual value.
90
+ */
91
+ interface IError {
92
+ /**
93
+ * Property path to the error location.
94
+ *
95
+ * A dot-notation path from the root input to the failing property. Uses
96
+ * `$input` as the root. Example: `"$input.user.email"` or
97
+ * `"$input.items[0].price"`.
98
+ */
99
+ path: string;
100
+ /**
101
+ * Expected type expression.
102
+ *
103
+ * A human-readable description of what type was expected at this location.
104
+ * Examples: `"string"`, `"number & ExclusiveMinimum<0>"`, `"(\"active\" |
105
+ * \"inactive\")"`.
106
+ */
107
+ expected: string;
108
+ /**
109
+ * The actual value that failed validation.
110
+ *
111
+ * The value found at the error path. May be `undefined` if the property was
112
+ * missing. Useful for debugging type mismatches.
113
+ */
114
+ value: unknown;
115
+ /**
116
+ * Human-readable error description.
117
+ *
118
+ * Optional additional context about the validation failure, such as
119
+ * constraint violations or custom error messages.
120
+ */
121
+ description?: string;
122
+ }
123
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IValidation.js","sourceRoot":"","sources":["../../src/schema/IValidation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export * from "./IResult";
2
+ export * from "./IValidation";
3
+ export * from "./IJsonSchemaTransformError";
4
+ export * from "./IJsonSchemaApplication";
5
+ export * from "./IJsonSchemaCollection";
6
+ export * from "./IJsonSchemaUnit";
7
+ export * from "./IJsonSchemaAttribute";
8
+ export * from "./ILlmController";
9
+ export * from "./ILlmApplication";
10
+ export * from "./ILlmFunction";
11
+ export * from "./ILlmSchema";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IResult"), exports);
18
+ __exportStar(require("./IValidation"), exports);
19
+ __exportStar(require("./IJsonSchemaTransformError"), exports);
20
+ __exportStar(require("./IJsonSchemaApplication"), exports);
21
+ __exportStar(require("./IJsonSchemaCollection"), exports);
22
+ __exportStar(require("./IJsonSchemaUnit"), exports);
23
+ __exportStar(require("./IJsonSchemaAttribute"), exports);
24
+ __exportStar(require("./ILlmController"), exports);
25
+ __exportStar(require("./ILlmApplication"), exports);
26
+ __exportStar(require("./ILlmFunction"), exports);
27
+ __exportStar(require("./ILlmSchema"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,gDAA8B;AAE9B,8DAA4C;AAC5C,2DAAyC;AACzC,0DAAwC;AACxC,oDAAkC;AAClC,yDAAuC;AAEvC,mDAAiC;AACjC,oDAAkC;AAClC,iDAA+B;AAC/B,+CAA6B"}