typia 9.7.2 → 10.0.0-dev.20251107

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/factories/ProtobufFactory.js +1 -1
  4. package/lib/factories/ProtobufFactory.mjs +1 -1
  5. package/lib/programmers/internal/json_schema_station.d.mts +2 -2
  6. package/lib/programmers/internal/json_schema_station.d.ts +2 -2
  7. package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
  8. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  9. package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
  10. package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
  11. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
  13. package/package.json +121 -121
  14. package/src/AssertionGuard.ts +41 -41
  15. package/src/CamelCase.ts +75 -75
  16. package/src/IRandomGenerator.ts +337 -337
  17. package/src/IReadableURLSearchParams.ts +9 -9
  18. package/src/PascalCase.ts +71 -71
  19. package/src/Primitive.ts +90 -90
  20. package/src/Resolved.ts +72 -72
  21. package/src/SnakeCase.ts +127 -127
  22. package/src/TypeGuardError.ts +216 -216
  23. package/src/factories/MetadataCollection.ts +270 -270
  24. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  25. package/src/factories/MetadataFactory.ts +402 -402
  26. package/src/factories/ProtobufFactory.ts +873 -873
  27. package/src/functional.ts +705 -705
  28. package/src/http.ts +972 -972
  29. package/src/internal/_ProtobufReader.ts +188 -188
  30. package/src/internal/_ProtobufSizer.ts +137 -137
  31. package/src/internal/_ProtobufWriter.ts +135 -135
  32. package/src/internal/_jsonStringifyString.ts +42 -42
  33. package/src/json.ts +643 -643
  34. package/src/llm.ts +615 -615
  35. package/src/misc.ts +594 -594
  36. package/src/module.ts +889 -889
  37. package/src/notations.ts +751 -751
  38. package/src/programmers/FeatureProgrammer.ts +605 -605
  39. package/src/programmers/ImportProgrammer.ts +179 -179
  40. package/src/programmers/RandomProgrammer.ts +1195 -1195
  41. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  42. package/src/programmers/internal/check_array_length.ts +43 -43
  43. package/src/programmers/internal/check_bigint.ts +46 -46
  44. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  45. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  46. package/src/programmers/internal/check_everything.ts +21 -21
  47. package/src/programmers/internal/check_native.ts +23 -23
  48. package/src/programmers/internal/check_number.ts +108 -108
  49. package/src/programmers/internal/check_object.ts +72 -72
  50. package/src/programmers/internal/check_string.ts +46 -46
  51. package/src/programmers/internal/check_template.ts +46 -46
  52. package/src/programmers/internal/check_union_array_like.ts +331 -331
  53. package/src/programmers/internal/decode_union_object.ts +110 -110
  54. package/src/programmers/internal/feature_object_entries.ts +59 -59
  55. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  56. package/src/programmers/internal/json_schema_object.ts +150 -150
  57. package/src/programmers/internal/json_schema_station.ts +2 -2
  58. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  59. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  60. package/src/programmers/internal/prune_object_properties.ts +69 -69
  61. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  62. package/src/programmers/internal/stringify_native.ts +5 -5
  63. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  64. package/src/programmers/internal/template_to_pattern.ts +21 -21
  65. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  66. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  67. package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
  68. package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
  69. package/src/protobuf.ts +820 -820
  70. package/src/reflect.ts +46 -46
  71. package/src/schemas/json/IJsonApplication.ts +77 -77
  72. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  73. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  74. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  75. package/src/schemas/metadata/Metadata.ts +669 -669
  76. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  77. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  78. package/src/schemas/metadata/MetadataArray.ts +47 -47
  79. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  80. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  81. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  82. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  83. package/src/schemas/metadata/MetadataObject.ts +46 -46
  84. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  85. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  86. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  87. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  88. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  89. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  90. package/src/tags/Constant.ts +47 -47
  91. package/src/tags/ContentMediaType.ts +27 -27
  92. package/src/tags/Default.ts +52 -52
  93. package/src/tags/Example.ts +56 -56
  94. package/src/tags/Examples.ts +56 -56
  95. package/src/tags/ExclusiveMaximum.ts +44 -44
  96. package/src/tags/ExclusiveMinimum.ts +44 -44
  97. package/src/tags/Format.ts +78 -78
  98. package/src/tags/JsonSchemaPlugin.ts +36 -36
  99. package/src/tags/MaxItems.ts +31 -31
  100. package/src/tags/MaxLength.ts +25 -25
  101. package/src/tags/Maximum.ts +39 -39
  102. package/src/tags/MinItems.ts +31 -31
  103. package/src/tags/MinLength.ts +25 -25
  104. package/src/tags/Minimum.ts +39 -39
  105. package/src/tags/MultipleOf.ts +42 -42
  106. package/src/tags/Pattern.ts +49 -49
  107. package/src/tags/Sequence.ts +37 -37
  108. package/src/tags/TagBase.ts +102 -102
  109. package/src/tags/Type.ts +64 -64
  110. package/src/tags/UniqueItems.ts +34 -34
  111. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  112. package/src/transformers/ITransformOptions.ts +70 -70
  113. package/src/transformers/ImportTransformer.ts +253 -253
  114. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  115. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  116. package/src/typings/Equal.ts +18 -18
@@ -1,263 +1,263 @@
1
- import { OpenApi, OpenApiV3 } from "@samchon/openapi";
2
-
3
- /**
4
- * Single unit of JSON schema representation.
5
- *
6
- * `IJsonSchemaUnit` represents a self-contained JSON schema unit that
7
- * encapsulates a single schema definition along with its associated reusable
8
- * components. This is typically used when generating a JSON schema for a single
9
- * TypeScript type, as opposed to a collection of multiple types.
10
- *
11
- * Unlike {@link IJsonSchemaCollection} which handles multiple schemas,
12
- * `IJsonSchemaUnit` focuses on representing a single schema with its
13
- * dependencies. This makes it ideal for scenarios where you need to work with
14
- * individual type definitions or when integrating with systems that expect
15
- * single schema documents.
16
- *
17
- * The unit contains:
18
- *
19
- * - A single JSON schema definition for the specified TypeScript type
20
- * - All necessary reusable components that the schema may reference
21
- * - Version-specific formatting for either OpenAPI v3.0 or v3.1 compatibility
22
- * - Optional type metadata for compile-time type safety
23
- *
24
- * Key differences from collection:
25
- *
26
- * - Contains only one schema instead of an array of schemas
27
- * - More lightweight for single-type use cases
28
- * - Simpler structure for direct schema consumption
29
- * - Still maintains full component reference support
30
- *
31
- * @author Jeongho Nam - https://github.com/samchon
32
- * @example
33
- * ```typescript
34
- * interface User {
35
- * id: string;
36
- * name: string;
37
- * email?: string;
38
- * }
39
- *
40
- * // Generate a single schema unit for OpenAPI v3.1 (default)
41
- * const userSchema = typia.json.schema<User>();
42
- * // Type: IJsonSchemaUnit<"3.1", User>
43
- *
44
- * // Generate a single schema unit for OpenAPI v3.0 (Swagger compatibility)
45
- * const swaggerUserSchema = typia.json.schema<User, "3.0">();
46
- * // Type: IJsonSchemaUnit<"3.0", User>
47
- * ```;
48
- *
49
- * @template Version The OpenAPI specification version to target ("3.0" or
50
- * "3.1"). Defaults to "3.1" for enhanced JSON Schema Draft 2020-12
51
- * compatibility. This determines the schema format, validation capabilities,
52
- * and available features like tuple support and null type handling.
53
- * @template Type The original TypeScript type that was analyzed to generate
54
- * this JSON schema unit. This provides compile-time type safety and enables
55
- * IDEs to provide better intellisense and validation.
56
- * @see {@link IJsonSchemaCollection} For handling multiple schemas at once
57
- */
58
- export type IJsonSchemaUnit<
59
- Version extends "3.0" | "3.1" = "3.1",
60
- Type = unknown,
61
- > = Version extends "3.0"
62
- ? IJsonSchemaUnit.IV3_0<Type>
63
- : IJsonSchemaUnit.IV3_1<Type>;
64
-
65
- export namespace IJsonSchemaUnit {
66
- /**
67
- * JSON Schema unit formatted for OpenAPI v3.0 specification.
68
- *
69
- * This interface represents a single JSON schema unit that complies with
70
- * OpenAPI v3.0 standards. It contains one schema definition along with any
71
- * reusable components that the schema references, formatted according to
72
- * OpenAPI v3.0 constraints and limitations.
73
- *
74
- * OpenAPI v3.0 characteristics affecting this unit:
75
- *
76
- * - Schema follows OpenAPI v3.0 JSON Schema subset
77
- * - Limited support for advanced JSON Schema features
78
- * - Uses nullable property for optional null values
79
- * - Cannot natively express tuple types or pattern properties
80
- * - Based on JSON Schema Draft 4 with OpenAPI-specific extensions
81
- *
82
- * Use cases for v3.0:
83
- *
84
- * - Integration with legacy Swagger tooling
85
- * - Compatibility with older OpenAPI implementations
86
- * - Systems that specifically require OpenAPI v3.0 format
87
- * - Code generation tools that expect v3.0 schemas
88
- *
89
- * @template Type The original TypeScript type represented by this schema
90
- * unit. Provides compile-time type information and enables type-safe
91
- * operations on the schema.
92
- */
93
- export interface IV3_0<Type> {
94
- /**
95
- * OpenAPI specification version identifier.
96
- *
97
- * Always set to "3.0" to indicate this schema unit uses OpenAPI v3.0 format
98
- * and adheres to its specific constraints and limitations.
99
- */
100
- version: "3.0";
101
-
102
- /**
103
- * The primary JSON schema definition.
104
- *
105
- * Contains the main JSON schema that represents the TypeScript type
106
- * specified in the `Type` template parameter. This schema follows OpenAPI
107
- * v3.0 format and may contain references to reusable components defined in
108
- * the {@link components} property.
109
- *
110
- * The schema structure includes:
111
- *
112
- * - Type definitions following OpenAPI v3.0 constraints
113
- * - Property definitions with v3.0-compatible validation rules
114
- * - References to shared components using $ref syntax
115
- * - Nullable properties for optional fields that can be null
116
- *
117
- * Example schema reference: `{ "$ref": "#/components/schemas/NestedType" }`
118
- */
119
- schema: OpenApiV3.IJsonSchema;
120
-
121
- /**
122
- * Reusable schema components for OpenAPI v3.0.
123
- *
124
- * Contains all reusable schema definitions and components that may be
125
- * referenced by the main schema. This enables schema modularity and
126
- * prevents duplication when the same types are used in multiple places
127
- * within the schema definition.
128
- *
129
- * Component categories include:
130
- *
131
- * - Schemas: Named type definitions for complex objects, arrays, and unions
132
- * - SecuritySchemes: Authentication and authorization definitions
133
- * - Parameters: Reusable parameter specifications
134
- * - RequestBodies: Reusable request body definitions
135
- * - Responses: Reusable response specifications
136
- * - Headers: Reusable header definitions
137
- * - Examples: Reusable example values
138
- *
139
- * All components follow OpenAPI v3.0 format restrictions and capabilities.
140
- */
141
- components: OpenApiV3.IComponents;
142
-
143
- /**
144
- * Type metadata for compile-time type safety.
145
- *
146
- * This optional property maintains a reference to the original TypeScript
147
- * type that was used to generate this schema unit. It provides compile-time
148
- * type information without affecting the runtime JSON representation.
149
- *
150
- * Benefits of type metadata:
151
- *
152
- * - Enables type-safe schema validation and usage
153
- * - Provides IDE intellisense and autocompletion
154
- * - Allows compile-time checking of schema operations
155
- * - Maintains traceability to original TypeScript definitions
156
- *
157
- * The property is intentionally marked as optional and undefined to ensure
158
- * it doesn't appear in serialized JSON output while preserving type
159
- * information at compile time.
160
- */
161
- __type?: Type | undefined;
162
- }
163
-
164
- /**
165
- * JSON Schema unit formatted for OpenAPI v3.1 specification.
166
- *
167
- * This interface represents a single JSON schema unit that takes advantage of
168
- * OpenAPI v3.1's enhanced capabilities and improved JSON Schema
169
- * compatibility. It provides a more feature-rich and accurate representation
170
- * of TypeScript types compared to the v3.0 format.
171
- *
172
- * OpenAPI v3.1 advantages for this unit:
173
- *
174
- * - Full JSON Schema Draft 2020-12 compatibility
175
- * - Native tuple type support using prefixItems
176
- * - Proper null type handling via union types
177
- * - Pattern properties for dynamic object keys
178
- * - Enhanced const, enum, and validation capabilities
179
- * - Better support for complex nested structures
180
- *
181
- * Use cases for v3.1:
182
- *
183
- * - Modern OpenAPI implementations and tooling
184
- * - Systems requiring accurate TypeScript type representation
185
- * - Applications needing advanced JSON Schema features
186
- * - New projects without legacy compatibility requirements
187
- *
188
- * @template Type The original TypeScript type represented by this schema
189
- * unit. Enables compile-time type safety and provides enhanced development
190
- * experience with better IDE support.
191
- */
192
- export interface IV3_1<Type> {
193
- /**
194
- * OpenAPI specification version identifier.
195
- *
196
- * Always set to "3.1" to indicate this schema unit uses OpenAPI v3.1 format
197
- * with enhanced JSON Schema compatibility and modern features.
198
- */
199
- version: "3.1";
200
-
201
- /**
202
- * The primary JSON schema definition with v3.1 enhancements.
203
- *
204
- * Contains the main JSON schema that accurately represents the TypeScript
205
- * type using OpenAPI v3.1's enhanced capabilities. This schema can express
206
- * complex TypeScript constructs that were not possible or accurate in
207
- * v3.0.
208
- *
209
- * Enhanced schema features include:
210
- *
211
- * - Tuple types using prefixItems for exact array structure
212
- * - Union types with proper null handling via oneOf
213
- * - Const values for literal types
214
- * - Pattern properties for Record<string, T> types
215
- * - Advanced validation constraints and metadata
216
- * - Recursive type definitions with proper $ref handling
217
- *
218
- * The schema follows the emended OpenAPI v3.1 format used by typia, which
219
- * removes ambiguous expressions while maintaining full compatibility.
220
- */
221
- schema: OpenApi.IJsonSchema;
222
-
223
- /**
224
- * Reusable schema components for OpenAPI v3.1.
225
- *
226
- * Contains reusable schema definitions and components that leverage OpenAPI
227
- * v3.1's enhanced capabilities. These components provide better type
228
- * representation and more accurate schema definitions compared to v3.0.
229
- *
230
- * Enhanced component features:
231
- *
232
- * - Schemas: More accurate type definitions with v3.1 JSON Schema features
233
- * - SecuritySchemes: Enhanced authentication scheme definitions
234
- * - Better support for complex nested references
235
- * - Improved handling of recursive and circular type dependencies
236
- *
237
- * The components structure follows the emended OpenAPI v3.1 specification
238
- * that simplifies certain patterns while maintaining full expressiveness.
239
- */
240
- components: OpenApi.IComponents;
241
-
242
- /**
243
- * Type metadata for enhanced compile-time type safety.
244
- *
245
- * This optional property preserves the original TypeScript type information
246
- * for compile-time type checking and enhanced development experience. It
247
- * enables type-safe operations and better IDE support without affecting the
248
- * runtime JSON schema representation.
249
- *
250
- * Enhanced type safety features:
251
- *
252
- * - Strong typing connection to original TypeScript definitions
253
- * - Better IDE intellisense and error detection
254
- * - Compile-time validation of schema usage patterns
255
- * - Type-safe integration with validation and serialization libraries
256
- * - Enhanced debugging and development experience
257
- *
258
- * The property remains optional and undefined to maintain clean JSON
259
- * serialization while preserving valuable compile-time information.
260
- */
261
- __type?: Type | undefined;
262
- }
263
- }
1
+ import { OpenApi, OpenApiV3 } from "@samchon/openapi";
2
+
3
+ /**
4
+ * Single unit of JSON schema representation.
5
+ *
6
+ * `IJsonSchemaUnit` represents a self-contained JSON schema unit that
7
+ * encapsulates a single schema definition along with its associated reusable
8
+ * components. This is typically used when generating a JSON schema for a single
9
+ * TypeScript type, as opposed to a collection of multiple types.
10
+ *
11
+ * Unlike {@link IJsonSchemaCollection} which handles multiple schemas,
12
+ * `IJsonSchemaUnit` focuses on representing a single schema with its
13
+ * dependencies. This makes it ideal for scenarios where you need to work with
14
+ * individual type definitions or when integrating with systems that expect
15
+ * single schema documents.
16
+ *
17
+ * The unit contains:
18
+ *
19
+ * - A single JSON schema definition for the specified TypeScript type
20
+ * - All necessary reusable components that the schema may reference
21
+ * - Version-specific formatting for either OpenAPI v3.0 or v3.1 compatibility
22
+ * - Optional type metadata for compile-time type safety
23
+ *
24
+ * Key differences from collection:
25
+ *
26
+ * - Contains only one schema instead of an array of schemas
27
+ * - More lightweight for single-type use cases
28
+ * - Simpler structure for direct schema consumption
29
+ * - Still maintains full component reference support
30
+ *
31
+ * @author Jeongho Nam - https://github.com/samchon
32
+ * @example
33
+ * ```typescript
34
+ * interface User {
35
+ * id: string;
36
+ * name: string;
37
+ * email?: string;
38
+ * }
39
+ *
40
+ * // Generate a single schema unit for OpenAPI v3.1 (default)
41
+ * const userSchema = typia.json.schema<User>();
42
+ * // Type: IJsonSchemaUnit<"3.1", User>
43
+ *
44
+ * // Generate a single schema unit for OpenAPI v3.0 (Swagger compatibility)
45
+ * const swaggerUserSchema = typia.json.schema<User, "3.0">();
46
+ * // Type: IJsonSchemaUnit<"3.0", User>
47
+ * ```;
48
+ *
49
+ * @template Version The OpenAPI specification version to target ("3.0" or
50
+ * "3.1"). Defaults to "3.1" for enhanced JSON Schema Draft 2020-12
51
+ * compatibility. This determines the schema format, validation capabilities,
52
+ * and available features like tuple support and null type handling.
53
+ * @template Type The original TypeScript type that was analyzed to generate
54
+ * this JSON schema unit. This provides compile-time type safety and enables
55
+ * IDEs to provide better intellisense and validation.
56
+ * @see {@link IJsonSchemaCollection} For handling multiple schemas at once
57
+ */
58
+ export type IJsonSchemaUnit<
59
+ Version extends "3.0" | "3.1" = "3.1",
60
+ Type = unknown,
61
+ > = Version extends "3.0"
62
+ ? IJsonSchemaUnit.IV3_0<Type>
63
+ : IJsonSchemaUnit.IV3_1<Type>;
64
+
65
+ export namespace IJsonSchemaUnit {
66
+ /**
67
+ * JSON Schema unit formatted for OpenAPI v3.0 specification.
68
+ *
69
+ * This interface represents a single JSON schema unit that complies with
70
+ * OpenAPI v3.0 standards. It contains one schema definition along with any
71
+ * reusable components that the schema references, formatted according to
72
+ * OpenAPI v3.0 constraints and limitations.
73
+ *
74
+ * OpenAPI v3.0 characteristics affecting this unit:
75
+ *
76
+ * - Schema follows OpenAPI v3.0 JSON Schema subset
77
+ * - Limited support for advanced JSON Schema features
78
+ * - Uses nullable property for optional null values
79
+ * - Cannot natively express tuple types or pattern properties
80
+ * - Based on JSON Schema Draft 4 with OpenAPI-specific extensions
81
+ *
82
+ * Use cases for v3.0:
83
+ *
84
+ * - Integration with legacy Swagger tooling
85
+ * - Compatibility with older OpenAPI implementations
86
+ * - Systems that specifically require OpenAPI v3.0 format
87
+ * - Code generation tools that expect v3.0 schemas
88
+ *
89
+ * @template Type The original TypeScript type represented by this schema
90
+ * unit. Provides compile-time type information and enables type-safe
91
+ * operations on the schema.
92
+ */
93
+ export interface IV3_0<Type> {
94
+ /**
95
+ * OpenAPI specification version identifier.
96
+ *
97
+ * Always set to "3.0" to indicate this schema unit uses OpenAPI v3.0 format
98
+ * and adheres to its specific constraints and limitations.
99
+ */
100
+ version: "3.0";
101
+
102
+ /**
103
+ * The primary JSON schema definition.
104
+ *
105
+ * Contains the main JSON schema that represents the TypeScript type
106
+ * specified in the `Type` template parameter. This schema follows OpenAPI
107
+ * v3.0 format and may contain references to reusable components defined in
108
+ * the {@link components} property.
109
+ *
110
+ * The schema structure includes:
111
+ *
112
+ * - Type definitions following OpenAPI v3.0 constraints
113
+ * - Property definitions with v3.0-compatible validation rules
114
+ * - References to shared components using $ref syntax
115
+ * - Nullable properties for optional fields that can be null
116
+ *
117
+ * Example schema reference: `{ "$ref": "#/components/schemas/NestedType" }`
118
+ */
119
+ schema: OpenApiV3.IJsonSchema;
120
+
121
+ /**
122
+ * Reusable schema components for OpenAPI v3.0.
123
+ *
124
+ * Contains all reusable schema definitions and components that may be
125
+ * referenced by the main schema. This enables schema modularity and
126
+ * prevents duplication when the same types are used in multiple places
127
+ * within the schema definition.
128
+ *
129
+ * Component categories include:
130
+ *
131
+ * - Schemas: Named type definitions for complex objects, arrays, and unions
132
+ * - SecuritySchemes: Authentication and authorization definitions
133
+ * - Parameters: Reusable parameter specifications
134
+ * - RequestBodies: Reusable request body definitions
135
+ * - Responses: Reusable response specifications
136
+ * - Headers: Reusable header definitions
137
+ * - Examples: Reusable example values
138
+ *
139
+ * All components follow OpenAPI v3.0 format restrictions and capabilities.
140
+ */
141
+ components: OpenApiV3.IComponents;
142
+
143
+ /**
144
+ * Type metadata for compile-time type safety.
145
+ *
146
+ * This optional property maintains a reference to the original TypeScript
147
+ * type that was used to generate this schema unit. It provides compile-time
148
+ * type information without affecting the runtime JSON representation.
149
+ *
150
+ * Benefits of type metadata:
151
+ *
152
+ * - Enables type-safe schema validation and usage
153
+ * - Provides IDE intellisense and autocompletion
154
+ * - Allows compile-time checking of schema operations
155
+ * - Maintains traceability to original TypeScript definitions
156
+ *
157
+ * The property is intentionally marked as optional and undefined to ensure
158
+ * it doesn't appear in serialized JSON output while preserving type
159
+ * information at compile time.
160
+ */
161
+ __type?: Type | undefined;
162
+ }
163
+
164
+ /**
165
+ * JSON Schema unit formatted for OpenAPI v3.1 specification.
166
+ *
167
+ * This interface represents a single JSON schema unit that takes advantage of
168
+ * OpenAPI v3.1's enhanced capabilities and improved JSON Schema
169
+ * compatibility. It provides a more feature-rich and accurate representation
170
+ * of TypeScript types compared to the v3.0 format.
171
+ *
172
+ * OpenAPI v3.1 advantages for this unit:
173
+ *
174
+ * - Full JSON Schema Draft 2020-12 compatibility
175
+ * - Native tuple type support using prefixItems
176
+ * - Proper null type handling via union types
177
+ * - Pattern properties for dynamic object keys
178
+ * - Enhanced const, enum, and validation capabilities
179
+ * - Better support for complex nested structures
180
+ *
181
+ * Use cases for v3.1:
182
+ *
183
+ * - Modern OpenAPI implementations and tooling
184
+ * - Systems requiring accurate TypeScript type representation
185
+ * - Applications needing advanced JSON Schema features
186
+ * - New projects without legacy compatibility requirements
187
+ *
188
+ * @template Type The original TypeScript type represented by this schema
189
+ * unit. Enables compile-time type safety and provides enhanced development
190
+ * experience with better IDE support.
191
+ */
192
+ export interface IV3_1<Type> {
193
+ /**
194
+ * OpenAPI specification version identifier.
195
+ *
196
+ * Always set to "3.1" to indicate this schema unit uses OpenAPI v3.1 format
197
+ * with enhanced JSON Schema compatibility and modern features.
198
+ */
199
+ version: "3.1";
200
+
201
+ /**
202
+ * The primary JSON schema definition with v3.1 enhancements.
203
+ *
204
+ * Contains the main JSON schema that accurately represents the TypeScript
205
+ * type using OpenAPI v3.1's enhanced capabilities. This schema can express
206
+ * complex TypeScript constructs that were not possible or accurate in
207
+ * v3.0.
208
+ *
209
+ * Enhanced schema features include:
210
+ *
211
+ * - Tuple types using prefixItems for exact array structure
212
+ * - Union types with proper null handling via oneOf
213
+ * - Const values for literal types
214
+ * - Pattern properties for Record<string, T> types
215
+ * - Advanced validation constraints and metadata
216
+ * - Recursive type definitions with proper $ref handling
217
+ *
218
+ * The schema follows the emended OpenAPI v3.1 format used by typia, which
219
+ * removes ambiguous expressions while maintaining full compatibility.
220
+ */
221
+ schema: OpenApi.IJsonSchema;
222
+
223
+ /**
224
+ * Reusable schema components for OpenAPI v3.1.
225
+ *
226
+ * Contains reusable schema definitions and components that leverage OpenAPI
227
+ * v3.1's enhanced capabilities. These components provide better type
228
+ * representation and more accurate schema definitions compared to v3.0.
229
+ *
230
+ * Enhanced component features:
231
+ *
232
+ * - Schemas: More accurate type definitions with v3.1 JSON Schema features
233
+ * - SecuritySchemes: Enhanced authentication scheme definitions
234
+ * - Better support for complex nested references
235
+ * - Improved handling of recursive and circular type dependencies
236
+ *
237
+ * The components structure follows the emended OpenAPI v3.1 specification
238
+ * that simplifies certain patterns while maintaining full expressiveness.
239
+ */
240
+ components: OpenApi.IComponents;
241
+
242
+ /**
243
+ * Type metadata for enhanced compile-time type safety.
244
+ *
245
+ * This optional property preserves the original TypeScript type information
246
+ * for compile-time type checking and enhanced development experience. It
247
+ * enables type-safe operations and better IDE support without affecting the
248
+ * runtime JSON schema representation.
249
+ *
250
+ * Enhanced type safety features:
251
+ *
252
+ * - Strong typing connection to original TypeScript definitions
253
+ * - Better IDE intellisense and error detection
254
+ * - Compile-time validation of schema usage patterns
255
+ * - Type-safe integration with validation and serialization libraries
256
+ * - Enhanced debugging and development experience
257
+ *
258
+ * The property remains optional and undefined to maintain clean JSON
259
+ * serialization while preserving valuable compile-time information.
260
+ */
261
+ __type?: Type | undefined;
262
+ }
263
+ }
@@ -1,14 +1,14 @@
1
- import type ts from "typescript";
2
-
3
- export interface IMetadataTypeTag {
4
- target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
5
- name: string;
6
- kind: string;
7
- exclusive: boolean | string[];
8
- value?: any;
9
- validate?: string | undefined;
10
- schema?: object | undefined;
11
-
12
- /** @internal */
13
- predicate?: (input: ts.Expression) => ts.Expression;
14
- }
1
+ import type ts from "typescript";
2
+
3
+ export interface IMetadataTypeTag {
4
+ target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
5
+ name: string;
6
+ kind: string;
7
+ exclusive: boolean | string[];
8
+ value?: any;
9
+ validate?: string | undefined;
10
+ schema?: object | undefined;
11
+
12
+ /** @internal */
13
+ predicate?: (input: ts.Expression) => ts.Expression;
14
+ }