@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,274 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { OpenApiV3 } from "../openapi/OpenApiV3";
3
+
4
+ /**
5
+ * JSON Schema application representing TypeScript functions.
6
+ *
7
+ * `IJsonSchemaApplication` represents a collection of TypeScript class methods
8
+ * or functions converted to JSON Schema format. Generated at compile time by
9
+ * `typia.json.application<App>()`, this is primarily used for OpenAPI document
10
+ * generation and as an intermediate format for LLM function calling schemas.
11
+ *
12
+ * Unlike {@link ILlmApplication} which is optimized for LLM consumption, this
13
+ * interface preserves full JSON Schema expressiveness including features that
14
+ * some LLM providers don't support (tuples, additionalProperties, etc.).
15
+ *
16
+ * The application contains:
17
+ *
18
+ * - {@link functions}: Array of function metadata with parameter/return schemas
19
+ * - {@link components}: Shared schema definitions for `$ref` references
20
+ * - {@link __application}: Phantom property for type inference
21
+ *
22
+ * @author Jeongho Nam - https://github.com/samchon
23
+ * @template Version OpenAPI version ("3.0" or "3.1")
24
+ * @template App Source class/interface type for type preservation
25
+ */
26
+ export interface IJsonSchemaApplication<
27
+ Version extends "3.0" | "3.1" = "3.1",
28
+ App extends any = object,
29
+ > {
30
+ /**
31
+ * OpenAPI specification version.
32
+ *
33
+ * Determines the JSON Schema dialect used for type definitions. Use `"3.1"`
34
+ * for modern JSON Schema features, `"3.0"` for broader compatibility with
35
+ * older OpenAPI consumers.
36
+ */
37
+ version: Version;
38
+
39
+ /**
40
+ * Shared schema definitions for `$ref` references.
41
+ *
42
+ * Contains named schemas that can be referenced by functions to avoid
43
+ * duplication and enable recursive type definitions.
44
+ */
45
+ components: IJsonSchemaApplication.IComponents<
46
+ IJsonSchemaApplication.Schema<Version>
47
+ >;
48
+
49
+ /**
50
+ * Array of function schemas.
51
+ *
52
+ * Each function includes parameter schemas, return type schema, and metadata
53
+ * extracted from JSDoc comments. Functions are derived from public methods of
54
+ * the source class/interface.
55
+ */
56
+ functions: IJsonSchemaApplication.IFunction<
57
+ IJsonSchemaApplication.Schema<Version>
58
+ >[];
59
+
60
+ /**
61
+ * Phantom property for TypeScript generic type preservation.
62
+ *
63
+ * This property exists only in the type system to preserve the `App` generic
64
+ * parameter at compile time. It is always `undefined` at runtime and should
65
+ * not be accessed or used in application code.
66
+ *
67
+ * Enables type inference to recover the original application type from an
68
+ * `IJsonSchemaApplication` instance.
69
+ */
70
+ __application?: App | undefined;
71
+ }
72
+ export namespace IJsonSchemaApplication {
73
+ /**
74
+ * Schema type selector based on OpenAPI version.
75
+ *
76
+ * Returns the appropriate JSON schema type for the specified OpenAPI version.
77
+ *
78
+ * - `"3.1"` → {@link OpenApi.IJsonSchema} (emended OpenAPI v3.1)
79
+ * - `"3.0"` → {@link OpenApiV3.IJsonSchema} (OpenAPI v3.0)
80
+ */
81
+ export type Schema<Version extends "3.0" | "3.1"> = Version extends "3.1"
82
+ ? OpenApi.IJsonSchema
83
+ : OpenApiV3.IJsonSchema;
84
+
85
+ /**
86
+ * Shared schema component definitions.
87
+ *
88
+ * Contains named schema definitions that can be referenced via `$ref`
89
+ * throughout the application's function schemas. Reduces duplication and
90
+ * enables recursive type definitions.
91
+ *
92
+ * @template Schema JSON schema type based on OpenAPI version
93
+ */
94
+ export interface IComponents<
95
+ Schema extends OpenApi.IJsonSchema | OpenApiV3.IJsonSchema =
96
+ OpenApi.IJsonSchema,
97
+ > {
98
+ /**
99
+ * Named schema definitions for reference.
100
+ *
101
+ * Keys are type names, values are their JSON Schema definitions. Reference
102
+ * these using `$ref: "#/components/schemas/TypeName"`.
103
+ */
104
+ schemas?: Record<string, Schema>;
105
+ }
106
+
107
+ /**
108
+ * Complete metadata for a single function.
109
+ *
110
+ * Contains all information needed to describe a function in JSON Schema
111
+ * format, including parameters, return type, and documentation extracted from
112
+ * JSDoc comments.
113
+ *
114
+ * @template Schema JSON schema type based on OpenAPI version
115
+ */
116
+ export interface IFunction<
117
+ Schema extends OpenApi.IJsonSchema | OpenApiV3.IJsonSchema =
118
+ OpenApi.IJsonSchema,
119
+ > {
120
+ /**
121
+ * Whether the function is asynchronous.
122
+ *
123
+ * `true` if the function returns a Promise, `false` for synchronous
124
+ * functions. Useful for runtime execution handling.
125
+ */
126
+ async: boolean;
127
+
128
+ /**
129
+ * Function name identifier.
130
+ *
131
+ * The name used to call this function. Derived from the method name in the
132
+ * source class/interface.
133
+ */
134
+ name: string;
135
+
136
+ /**
137
+ * Array of function parameters.
138
+ *
139
+ * Ordered list of parameters with their names, types, and documentation.
140
+ * Parameters preserve their declaration order.
141
+ */
142
+ parameters: IParameter<Schema>[];
143
+
144
+ /**
145
+ * Return type information.
146
+ *
147
+ * Contains the return type schema and documentation. `undefined` when the
148
+ * function returns `void` or has no return type annotation.
149
+ */
150
+ output: IOutput<Schema> | undefined;
151
+
152
+ /**
153
+ * Brief summary of the function.
154
+ *
155
+ * Short one-line description extracted from the first line of JSDoc
156
+ * comment. Intended for quick reference in documentation.
157
+ */
158
+ summary?: string | undefined;
159
+
160
+ /**
161
+ * Full function description.
162
+ *
163
+ * Complete documentation extracted from JSDoc comment body. May include
164
+ * markdown formatting, examples, and detailed explanations.
165
+ */
166
+ description?: string | undefined;
167
+
168
+ /**
169
+ * Whether the function is deprecated.
170
+ *
171
+ * Set from the `@deprecated` JSDoc tag. Indicates the function should no
172
+ * longer be used and may be removed in future versions.
173
+ */
174
+ deprecated?: boolean;
175
+
176
+ /**
177
+ * Category tags for organization.
178
+ *
179
+ * Extracted from `@tag` JSDoc annotations. Useful for grouping related
180
+ * functions in documentation or filtering.
181
+ */
182
+ tags?: string[];
183
+ }
184
+
185
+ /**
186
+ * Metadata for a single function parameter.
187
+ *
188
+ * Describes a function parameter including its name, type schema, whether
189
+ * it's required, and any JSDoc documentation.
190
+ *
191
+ * @template Schema JSON schema type based on OpenAPI version
192
+ */
193
+ export interface IParameter<
194
+ Schema extends OpenApi.IJsonSchema | OpenApiV3.IJsonSchema =
195
+ OpenApi.IJsonSchema,
196
+ > {
197
+ /**
198
+ * Parameter name.
199
+ *
200
+ * The identifier used in the function signature. Must match the actual
201
+ * parameter name in the source code.
202
+ */
203
+ name: string;
204
+
205
+ /**
206
+ * Whether the parameter is required.
207
+ *
208
+ * `true` if the parameter must be provided, `false` if it has a default
209
+ * value or is explicitly optional.
210
+ */
211
+ required: boolean;
212
+
213
+ /**
214
+ * JSON Schema for the parameter type.
215
+ *
216
+ * Complete schema definition describing the expected parameter type,
217
+ * including constraints and nested structures.
218
+ */
219
+ schema: Schema;
220
+
221
+ /**
222
+ * Parameter title for documentation.
223
+ *
224
+ * Brief name for the parameter, typically extracted from `@param` tag title
225
+ * in JSDoc.
226
+ */
227
+ title?: string | undefined;
228
+
229
+ /**
230
+ * Parameter description from documentation.
231
+ *
232
+ * Full description of the parameter's purpose and usage, extracted from the
233
+ * `@param` JSDoc tag.
234
+ */
235
+ description?: string | undefined;
236
+ }
237
+
238
+ /**
239
+ * Metadata for function return type.
240
+ *
241
+ * Describes the return type of a function including its schema, whether a
242
+ * value is always returned, and documentation.
243
+ *
244
+ * @template Schema JSON schema type based on OpenAPI version
245
+ */
246
+ export interface IOutput<
247
+ Schema extends OpenApi.IJsonSchema | OpenApiV3.IJsonSchema =
248
+ OpenApi.IJsonSchema,
249
+ > {
250
+ /**
251
+ * JSON Schema for the return type.
252
+ *
253
+ * Complete schema definition describing the return value type, including
254
+ * constraints and nested structures.
255
+ */
256
+ schema: Schema;
257
+
258
+ /**
259
+ * Whether a value is always returned.
260
+ *
261
+ * `true` if the function always returns a value, `false` if it may return
262
+ * `undefined` or has a void return type.
263
+ */
264
+ required: boolean;
265
+
266
+ /**
267
+ * Return value description from documentation.
268
+ *
269
+ * Explanation of what the function returns, extracted from the `@returns`
270
+ * or `@return` JSDoc tag.
271
+ */
272
+ description?: string | undefined;
273
+ }
274
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Common attributes shared by all JSON schema types.
3
+ *
4
+ * `IJsonSchemaAttribute` defines the base set of metadata properties that can
5
+ * be attached to any JSON schema type. These attributes provide documentation,
6
+ * deprecation status, examples, and access control information.
7
+ *
8
+ * This interface serves as the foundation for all schema types in typia's JSON
9
+ * Schema generation. The namespace contains type-specific variants (e.g.,
10
+ * {@link IBoolean}, {@link IString}) that add a `type` discriminator while
11
+ * inheriting all base attributes.
12
+ *
13
+ * These attributes are populated from JSDoc comments during schema generation:
14
+ *
15
+ * - `@title` tag → {@link title}
16
+ * - Main comment body → {@link description}
17
+ * - `@deprecated` tag → {@link deprecated}
18
+ * - `@example` tag → {@link example}
19
+ *
20
+ * @author Jeongho Nam - https://github.com/samchon
21
+ */
22
+ export interface IJsonSchemaAttribute {
23
+ /**
24
+ * Short title for the schema.
25
+ *
26
+ * A brief, human-readable name for the type. Typically extracted from the
27
+ * first line of a JSDoc comment or the `@title` tag.
28
+ */
29
+ title?: string;
30
+
31
+ /**
32
+ * Detailed description of the schema.
33
+ *
34
+ * Full documentation for the type, explaining its purpose, constraints, and
35
+ * usage. Extracted from JSDoc comment body. Supports markdown formatting in
36
+ * many JSON Schema consumers.
37
+ */
38
+ description?: string;
39
+
40
+ /**
41
+ * Whether this type is deprecated.
42
+ *
43
+ * When `true`, indicates the type should no longer be used and may be removed
44
+ * in future versions. Set via the `@deprecated` JSDoc tag.
45
+ */
46
+ deprecated?: boolean;
47
+
48
+ /**
49
+ * Single example value for the schema.
50
+ *
51
+ * A representative value that conforms to the schema, useful for
52
+ * documentation and testing. Set via the `@example` JSDoc tag.
53
+ */
54
+ example?: any;
55
+
56
+ /**
57
+ * Named example values for the schema.
58
+ *
59
+ * Multiple examples as key-value pairs, where keys are example names and
60
+ * values are conforming data. Useful for showing different valid states or
61
+ * edge cases.
62
+ */
63
+ examples?: Record<string, any>;
64
+
65
+ /**
66
+ * Whether the property is read-only.
67
+ *
68
+ * When `true`, the property should not be modified by clients and is
69
+ * typically set by the server. Useful for generated IDs, timestamps, etc.
70
+ */
71
+ readOnly?: boolean;
72
+
73
+ /**
74
+ * Whether the property is write-only.
75
+ *
76
+ * When `true`, the property is accepted on input but never returned in
77
+ * responses. Common for sensitive data like passwords.
78
+ */
79
+ writeOnly?: boolean;
80
+ }
81
+ export namespace IJsonSchemaAttribute {
82
+ /**
83
+ * Attribute interface for boolean schema types.
84
+ *
85
+ * Extends base attributes with `type: "boolean"` discriminator.
86
+ */
87
+ export interface IBoolean extends ISignificant<"boolean"> {}
88
+
89
+ /**
90
+ * Attribute interface for integer schema types.
91
+ *
92
+ * Extends base attributes with `type: "integer"` discriminator. Note: JSON
93
+ * Schema uses "integer" for whole numbers, distinct from "number".
94
+ */
95
+ export interface IInteger extends ISignificant<"integer"> {}
96
+
97
+ /**
98
+ * Attribute interface for number schema types.
99
+ *
100
+ * Extends base attributes with `type: "number"` discriminator. Represents
101
+ * floating-point numbers in JSON Schema.
102
+ */
103
+ export interface INumber extends ISignificant<"number"> {}
104
+
105
+ /**
106
+ * Attribute interface for string schema types.
107
+ *
108
+ * Extends base attributes with `type: "string"` discriminator.
109
+ */
110
+ export interface IString extends ISignificant<"string"> {}
111
+
112
+ /**
113
+ * Attribute interface for object schema types.
114
+ *
115
+ * Extends base attributes with `type: "object"` discriminator. Used for
116
+ * structured data with named properties.
117
+ */
118
+ export interface IObject extends ISignificant<"object"> {}
119
+
120
+ /**
121
+ * Attribute interface for array schema types.
122
+ *
123
+ * Extends base attributes with `type: "array"` discriminator. Represents
124
+ * ordered collections of items.
125
+ */
126
+ export interface IArray extends ISignificant<"array"> {}
127
+
128
+ /**
129
+ * Attribute interface for null schema types.
130
+ *
131
+ * Extends base attributes with `type: "null"` discriminator. Represents the
132
+ * JSON null value.
133
+ */
134
+ export interface INull extends ISignificant<"null"> {}
135
+
136
+ /**
137
+ * Attribute interface for unknown/untyped schemas.
138
+ *
139
+ * Used when the schema type is not specified or cannot be determined. The
140
+ * `type` property is explicitly undefined to indicate no type constraint.
141
+ */
142
+ export interface IUnknown extends IJsonSchemaAttribute {
143
+ type?: undefined;
144
+ }
145
+
146
+ /**
147
+ * Base interface for type-discriminated schema attributes.
148
+ *
149
+ * Internal helper that combines base attributes with a type discriminator.
150
+ * Each specific type interface (IBoolean, IString, etc.) extends this with
151
+ * its corresponding type literal.
152
+ *
153
+ * @template Type - The JSON Schema type string literal
154
+ */
155
+ interface ISignificant<Type extends string> extends IJsonSchemaAttribute {
156
+ type: Type;
157
+ }
158
+ }
@@ -0,0 +1,123 @@
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { OpenApiV3 } from "../openapi/OpenApiV3";
3
+
4
+ /**
5
+ * Collection of JSON schemas generated from multiple TypeScript types.
6
+ *
7
+ * `IJsonSchemaCollection` holds JSON schemas for multiple TypeScript types
8
+ * generated at compile time by `typia.json.schemas<[T1, T2, ...]>()`. The
9
+ * schemas share a common components pool to avoid duplication when types
10
+ * reference each other.
11
+ *
12
+ * This is useful when you need schemas for multiple related types and want to
13
+ * share component definitions between them. For single types, use
14
+ * {@link IJsonSchemaUnit} instead. For function schemas, see
15
+ * {@link IJsonSchemaApplication}.
16
+ *
17
+ * The collection contains:
18
+ *
19
+ * - {@link IV3_1.schemas | schemas}: Array of schemas, one per input type
20
+ * - {@link IV3_1.components | components}: Shared `$ref` definitions
21
+ * - {@link IV3_1.__types | __types}: Phantom property for type inference
22
+ *
23
+ * @author Jeongho Nam - https://github.com/samchon
24
+ * @template Version OpenAPI version ("3.0" or "3.1")
25
+ * @template Types Tuple of original TypeScript types
26
+ */
27
+ export type IJsonSchemaCollection<
28
+ Version extends "3.0" | "3.1" = "3.1",
29
+ Types = unknown[],
30
+ > = Version extends "3.0"
31
+ ? IJsonSchemaCollection.IV3_0<Types>
32
+ : IJsonSchemaCollection.IV3_1<Types>;
33
+
34
+ export namespace IJsonSchemaCollection {
35
+ /**
36
+ * JSON Schema collection for OpenAPI v3.0 specification.
37
+ *
38
+ * Uses OpenAPI v3.0 compatible JSON Schema format. In v3.0, nullable types
39
+ * are expressed with `nullable: true` rather than v3.1's `type` arrays.
40
+ *
41
+ * @template Types Tuple of original TypeScript types for phantom type
42
+ * preservation
43
+ */
44
+ export interface IV3_0<Types = unknown[]> {
45
+ /**
46
+ * OpenAPI specification version.
47
+ *
48
+ * Always `"3.0"` for this variant. Use this discriminator to determine
49
+ * which schema format is in use.
50
+ */
51
+ version: "3.0";
52
+
53
+ /**
54
+ * Generated JSON schemas, one per input type.
55
+ *
56
+ * Array of schemas in the same order as the input type tuple. Each schema
57
+ * may reference definitions in {@link components}.
58
+ */
59
+ schemas: OpenApiV3.IJsonSchema[];
60
+
61
+ /**
62
+ * Shared schema definitions for `$ref` references.
63
+ *
64
+ * Contains named schemas used across multiple types in the collection.
65
+ * Reduces duplication when types share common structures.
66
+ */
67
+ components: OpenApiV3.IComponents;
68
+
69
+ /**
70
+ * Phantom property for TypeScript generic type preservation.
71
+ *
72
+ * This property exists only in the type system to preserve the `Types`
73
+ * generic parameter. It is always `undefined` at runtime and should not be
74
+ * accessed or used in application code.
75
+ */
76
+ __types?: Types | undefined;
77
+ }
78
+
79
+ /**
80
+ * JSON Schema collection for OpenAPI v3.1 specification.
81
+ *
82
+ * Uses OpenAPI v3.1 compatible JSON Schema format. v3.1 aligns more closely
83
+ * with JSON Schema draft 2020-12, supporting features like `type` arrays for
84
+ * nullable types and `const` values.
85
+ *
86
+ * @template Types Tuple of original TypeScript types for phantom type
87
+ * preservation
88
+ */
89
+ export interface IV3_1<Types = unknown[]> {
90
+ /**
91
+ * OpenAPI specification version.
92
+ *
93
+ * Always `"3.1"` for this variant. Use this discriminator to determine
94
+ * which schema format is in use.
95
+ */
96
+ version: "3.1";
97
+
98
+ /**
99
+ * Shared schema definitions for `$ref` references.
100
+ *
101
+ * Contains named schemas used across multiple types in the collection.
102
+ * Reduces duplication when types share common structures.
103
+ */
104
+ components: OpenApi.IComponents;
105
+
106
+ /**
107
+ * Generated JSON schemas, one per input type.
108
+ *
109
+ * Array of schemas in the same order as the input type tuple. Each schema
110
+ * may reference definitions in {@link components}.
111
+ */
112
+ schemas: OpenApi.IJsonSchema[];
113
+
114
+ /**
115
+ * Phantom property for TypeScript generic type preservation.
116
+ *
117
+ * This property exists only in the type system to preserve the `Types`
118
+ * generic parameter. It is always `undefined` at runtime and should not be
119
+ * accessed or used in application code.
120
+ */
121
+ __types?: Types | undefined;
122
+ }
123
+ }
@@ -0,0 +1,86 @@
1
+ import { OpenApi } from "../openapi";
2
+
3
+ /**
4
+ * Error information from JSON schema transformation.
5
+ *
6
+ * `IJsonSchemaTransformError` represents an error that occurred during
7
+ * transformation or iteration of {@link OpenApi.IJsonSchema} types. This error
8
+ * type is primarily generated when converting OpenAPI schemas to LLM-compatible
9
+ * formats via {@link ILlmSchema}.
10
+ *
11
+ * Common transformation failures include:
12
+ *
13
+ * - **Missing references**: `$ref` pointing to non-existent schema definitions
14
+ * - **Unsupported tuple types**: All LLM providers reject tuple schemas
15
+ * - **Unsupported union types**: Gemini does not support `oneOf` schemas
16
+ * - **Unsupported dynamic objects**: ChatGPT and Gemini reject
17
+ * `additionalProperties`
18
+ *
19
+ * The {@link reasons} array provides detailed information about each failure,
20
+ * including the problematic schema, its location path, and a human-readable
21
+ * error message. Use this information to diagnose and fix schema compatibility
22
+ * issues.
23
+ *
24
+ * @author Jeongho Nam - https://github.com/samchon
25
+ */
26
+ export interface IJsonSchemaTransformError {
27
+ /**
28
+ * Name of the method that caused the error.
29
+ *
30
+ * Identifies which transformation function failed, such as
31
+ * `"HttpLlm.application"` or `"LlmSchemaConverter.schema"`.
32
+ */
33
+ method: string;
34
+
35
+ /**
36
+ * Summary error message.
37
+ *
38
+ * A human-readable description of the overall error. For detailed information
39
+ * about specific failures, examine the {@link reasons} array.
40
+ */
41
+ message: string;
42
+
43
+ /**
44
+ * Detailed list of transformation failures.
45
+ *
46
+ * Each entry describes a specific schema that failed transformation,
47
+ * including its location and the reason for failure. Multiple failures can
48
+ * occur in a single transformation when processing complex schemas.
49
+ */
50
+ reasons: IJsonSchemaTransformError.IReason[];
51
+ }
52
+ export namespace IJsonSchemaTransformError {
53
+ /**
54
+ * Detailed information about a single transformation failure.
55
+ *
56
+ * Provides the specific schema that failed, its accessor path for locating it
57
+ * within the document, and a message explaining why the transformation
58
+ * failed.
59
+ */
60
+ export interface IReason {
61
+ /**
62
+ * The schema that caused the transformation failure.
63
+ *
64
+ * The actual JSON schema object that could not be transformed. Inspect this
65
+ * to understand the problematic schema structure.
66
+ */
67
+ schema: OpenApi.IJsonSchema;
68
+
69
+ /**
70
+ * Path to the failing schema within the document.
71
+ *
72
+ * A dot-notation path (e.g., `"components.schemas.User.properties.tags"`)
73
+ * that identifies where the problematic schema is located. Use this to
74
+ * locate and fix the issue in the source OpenAPI document.
75
+ */
76
+ accessor: string;
77
+
78
+ /**
79
+ * Human-readable explanation of the failure.
80
+ *
81
+ * Describes why the schema could not be transformed, such as "Tuple type is
82
+ * not supported" or "Cannot resolve $ref reference".
83
+ */
84
+ message: string;
85
+ }
86
+ }