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.
- package/LICENSE +21 -21
- package/README.md +153 -153
- package/lib/factories/ProtobufFactory.js +1 -1
- package/lib/factories/ProtobufFactory.mjs +1 -1
- package/lib/programmers/internal/json_schema_station.d.mts +2 -2
- package/lib/programmers/internal/json_schema_station.d.ts +2 -2
- package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
- package/package.json +121 -121
- package/src/AssertionGuard.ts +41 -41
- package/src/CamelCase.ts +75 -75
- package/src/IRandomGenerator.ts +337 -337
- package/src/IReadableURLSearchParams.ts +9 -9
- package/src/PascalCase.ts +71 -71
- package/src/Primitive.ts +90 -90
- package/src/Resolved.ts +72 -72
- package/src/SnakeCase.ts +127 -127
- package/src/TypeGuardError.ts +216 -216
- package/src/factories/MetadataCollection.ts +270 -270
- package/src/factories/MetadataCommentTagFactory.ts +632 -632
- package/src/factories/MetadataFactory.ts +402 -402
- package/src/factories/ProtobufFactory.ts +873 -873
- package/src/functional.ts +705 -705
- package/src/http.ts +972 -972
- package/src/internal/_ProtobufReader.ts +188 -188
- package/src/internal/_ProtobufSizer.ts +137 -137
- package/src/internal/_ProtobufWriter.ts +135 -135
- package/src/internal/_jsonStringifyString.ts +42 -42
- package/src/json.ts +643 -643
- package/src/llm.ts +615 -615
- package/src/misc.ts +594 -594
- package/src/module.ts +889 -889
- package/src/notations.ts +751 -751
- package/src/programmers/FeatureProgrammer.ts +605 -605
- package/src/programmers/ImportProgrammer.ts +179 -179
- package/src/programmers/RandomProgrammer.ts +1195 -1195
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/internal/check_array_length.ts +43 -43
- package/src/programmers/internal/check_bigint.ts +46 -46
- package/src/programmers/internal/check_dynamic_key.ts +197 -197
- package/src/programmers/internal/check_dynamic_properties.ts +231 -231
- package/src/programmers/internal/check_everything.ts +21 -21
- package/src/programmers/internal/check_native.ts +23 -23
- package/src/programmers/internal/check_number.ts +108 -108
- package/src/programmers/internal/check_object.ts +72 -72
- package/src/programmers/internal/check_string.ts +46 -46
- package/src/programmers/internal/check_template.ts +46 -46
- package/src/programmers/internal/check_union_array_like.ts +331 -331
- package/src/programmers/internal/decode_union_object.ts +110 -110
- package/src/programmers/internal/feature_object_entries.ts +59 -59
- package/src/programmers/internal/json_schema_escaped.ts +78 -78
- package/src/programmers/internal/json_schema_object.ts +150 -150
- package/src/programmers/internal/json_schema_station.ts +2 -2
- package/src/programmers/internal/metadata_to_pattern.ts +40 -40
- package/src/programmers/internal/postfix_of_tuple.ts +3 -3
- package/src/programmers/internal/prune_object_properties.ts +69 -69
- package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
- package/src/programmers/internal/stringify_native.ts +5 -5
- package/src/programmers/internal/stringify_regular_properties.ts +77 -77
- package/src/programmers/internal/template_to_pattern.ts +21 -21
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
- package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
- package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
- package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
- package/src/protobuf.ts +820 -820
- package/src/reflect.ts +46 -46
- package/src/schemas/json/IJsonApplication.ts +77 -77
- package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
- package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
- package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
- package/src/schemas/metadata/Metadata.ts +669 -669
- package/src/schemas/metadata/MetadataAliasType.ts +57 -57
- package/src/schemas/metadata/MetadataApplication.ts +40 -40
- package/src/schemas/metadata/MetadataArray.ts +47 -47
- package/src/schemas/metadata/MetadataArrayType.ts +51 -51
- package/src/schemas/metadata/MetadataAtomic.ts +85 -85
- package/src/schemas/metadata/MetadataEscaped.ts +45 -45
- package/src/schemas/metadata/MetadataFunction.ts +45 -45
- package/src/schemas/metadata/MetadataObject.ts +46 -46
- package/src/schemas/metadata/MetadataObjectType.ts +137 -137
- package/src/schemas/metadata/MetadataParameter.ts +52 -52
- package/src/schemas/metadata/MetadataProperty.ts +53 -53
- package/src/schemas/metadata/MetadataTemplate.ts +78 -78
- package/src/schemas/metadata/MetadataTuple.ts +28 -28
- package/src/schemas/metadata/MetadataTupleType.ts +61 -61
- package/src/tags/Constant.ts +47 -47
- package/src/tags/ContentMediaType.ts +27 -27
- package/src/tags/Default.ts +52 -52
- package/src/tags/Example.ts +56 -56
- package/src/tags/Examples.ts +56 -56
- package/src/tags/ExclusiveMaximum.ts +44 -44
- package/src/tags/ExclusiveMinimum.ts +44 -44
- package/src/tags/Format.ts +78 -78
- package/src/tags/JsonSchemaPlugin.ts +36 -36
- package/src/tags/MaxItems.ts +31 -31
- package/src/tags/MaxLength.ts +25 -25
- package/src/tags/Maximum.ts +39 -39
- package/src/tags/MinItems.ts +31 -31
- package/src/tags/MinLength.ts +25 -25
- package/src/tags/Minimum.ts +39 -39
- package/src/tags/MultipleOf.ts +42 -42
- package/src/tags/Pattern.ts +49 -49
- package/src/tags/Sequence.ts +37 -37
- package/src/tags/TagBase.ts +102 -102
- package/src/tags/Type.ts +64 -64
- package/src/tags/UniqueItems.ts +34 -34
- package/src/tags/internal/FormatCheatSheet.ts +71 -71
- package/src/transformers/ITransformOptions.ts +70 -70
- package/src/transformers/ImportTransformer.ts +253 -253
- package/src/transformers/NoTransformConfigurationError.ts +16 -16
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
- package/src/typings/Equal.ts +18 -18
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
import type { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Collection of JSON schemas with OpenAPI specification support.
|
|
5
|
-
*
|
|
6
|
-
* `IJsonSchemaCollection` represents a comprehensive collection of JSON schemas
|
|
7
|
-
* that can be generated from TypeScript types using the `typia.json.schemas()`
|
|
8
|
-
* function. This interface supports both OpenAPI v3.0 and v3.1 specifications,
|
|
9
|
-
* with the ability to automatically generate appropriate schema definitions
|
|
10
|
-
* based on the specified version.
|
|
11
|
-
*
|
|
12
|
-
* The collection includes:
|
|
13
|
-
*
|
|
14
|
-
* - Generated JSON schemas array containing schema definitions for the specified
|
|
15
|
-
* types
|
|
16
|
-
* - Reusable components that can be referenced across different schemas
|
|
17
|
-
* - Version-specific formatting that adheres to either OpenAPI v3.0 or v3.1
|
|
18
|
-
* standards
|
|
19
|
-
*
|
|
20
|
-
* Key differences between versions:
|
|
21
|
-
*
|
|
22
|
-
* - OpenAPI v3.0: Uses {@link OpenApiV3.IJsonSchema} format with limited tuple
|
|
23
|
-
* support
|
|
24
|
-
* - OpenAPI v3.1: Uses {@link OpenApi.IJsonSchema} format with full JSON Schema
|
|
25
|
-
* Draft 2020-12 compatibility
|
|
26
|
-
*
|
|
27
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* // Generate schemas for OpenAPI v3.1 (default)
|
|
31
|
-
* const schemas = typia.json.schemas<[User, Product]>();
|
|
32
|
-
* // Type: IJsonSchemaCollection<"3.1", [User, Product]>
|
|
33
|
-
*
|
|
34
|
-
* // Generate schemas for OpenAPI v3.0 (Swagger compatibility)
|
|
35
|
-
* const swaggerSchemas = typia.json.schemas<[User, Product], "3.0">();
|
|
36
|
-
* // Type: IJsonSchemaCollection<"3.0", [User, Product]>
|
|
37
|
-
* ```;
|
|
38
|
-
*
|
|
39
|
-
* @template Version The OpenAPI specification version to target ("3.0" or
|
|
40
|
-
* "3.1"). Defaults to "3.1" for enhanced JSON Schema compatibility.
|
|
41
|
-
* @template Types Array of original TypeScript types that were analyzed to
|
|
42
|
-
* generate the JSON schemas. This provides type safety and traceability back
|
|
43
|
-
* to the source TypeScript definitions.
|
|
44
|
-
*/
|
|
45
|
-
export type IJsonSchemaCollection<
|
|
46
|
-
Version extends "3.0" | "3.1" = "3.1",
|
|
47
|
-
Types = unknown[],
|
|
48
|
-
> = Version extends "3.0"
|
|
49
|
-
? IJsonSchemaCollection.IV3_0<Types>
|
|
50
|
-
: IJsonSchemaCollection.IV3_1<Types>;
|
|
51
|
-
|
|
52
|
-
export namespace IJsonSchemaCollection {
|
|
53
|
-
/**
|
|
54
|
-
* JSON Schema collection formatted for OpenAPI v3.0 specification.
|
|
55
|
-
*
|
|
56
|
-
* This interface represents a collection of JSON schemas that comply with
|
|
57
|
-
* OpenAPI v3.0 standards, which are compatible with Swagger tools and legacy
|
|
58
|
-
* OpenAPI implementations. OpenAPI v3.0 has some limitations compared to
|
|
59
|
-
* v3.1, particularly around tuple types and pattern properties.
|
|
60
|
-
*
|
|
61
|
-
* Key characteristics of v3.0:
|
|
62
|
-
*
|
|
63
|
-
* - Cannot express tuple types natively (falls back to array representations)
|
|
64
|
-
* - Cannot express pattern properties in object schemas
|
|
65
|
-
* - Uses nullable property instead of union with null type
|
|
66
|
-
* - Limited JSON Schema Draft compatibility (based on Draft 4)
|
|
67
|
-
*
|
|
68
|
-
* @template Types Array of original TypeScript types used to generate the
|
|
69
|
-
* schemas. This provides compile-time type information about what types
|
|
70
|
-
* were analyzed during schema generation.
|
|
71
|
-
*/
|
|
72
|
-
export interface IV3_0<Types = unknown[]> {
|
|
73
|
-
/**
|
|
74
|
-
* OpenAPI specification version identifier.
|
|
75
|
-
*
|
|
76
|
-
* Always set to "3.0" to indicate this collection uses OpenAPI v3.0 schema
|
|
77
|
-
* format and constraints.
|
|
78
|
-
*/
|
|
79
|
-
version: "3.0";
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Array of generated JSON schemas.
|
|
83
|
-
*
|
|
84
|
-
* Contains the actual JSON schema definitions generated from the input
|
|
85
|
-
* TypeScript types. Each schema in this array corresponds to one of the
|
|
86
|
-
* types specified in the `Types` template parameter. The schemas follow
|
|
87
|
-
* OpenAPI v3.0 format and may contain references to components defined in
|
|
88
|
-
* the {@link components} property.
|
|
89
|
-
*
|
|
90
|
-
* Schema references typically use the format: `{ "$ref":
|
|
91
|
-
* "#/components/schemas/TypeName" }`
|
|
92
|
-
*/
|
|
93
|
-
schemas: OpenApiV3.IJsonSchema[];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Reusable schema components for OpenAPI v3.0.
|
|
97
|
-
*
|
|
98
|
-
* Contains reusable schema definitions, security schemes, and other
|
|
99
|
-
* components that can be referenced from the main schemas. This follows the
|
|
100
|
-
* OpenAPI v3.0 components structure and enables schema reuse and
|
|
101
|
-
* modularity.
|
|
102
|
-
*
|
|
103
|
-
* Components include:
|
|
104
|
-
*
|
|
105
|
-
* - Schemas: Named type definitions that can be referenced via $ref
|
|
106
|
-
* - SecuritySchemes: Authentication and authorization schemes
|
|
107
|
-
* - Parameters: Reusable parameter definitions
|
|
108
|
-
* - RequestBodies: Reusable request body definitions
|
|
109
|
-
* - Responses: Reusable response definitions
|
|
110
|
-
* - Headers: Reusable header definitions
|
|
111
|
-
* - Examples: Reusable example definitions
|
|
112
|
-
*/
|
|
113
|
-
components: OpenApiV3.IComponents;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Type metadata for compile-time type tracking.
|
|
117
|
-
*
|
|
118
|
-
* This optional property stores the original TypeScript types that were
|
|
119
|
-
* used to generate the JSON schemas. It's primarily used for type safety
|
|
120
|
-
* and doesn't affect runtime behavior. The property is marked as optional
|
|
121
|
-
* and undefined to prevent it from appearing in serialized JSON output.
|
|
122
|
-
*
|
|
123
|
-
* This enables:
|
|
124
|
-
*
|
|
125
|
-
* - Compile-time type checking against the original types
|
|
126
|
-
* - IDE intellisense and autocompletion
|
|
127
|
-
* - Type-safe schema validation and usage
|
|
128
|
-
*/
|
|
129
|
-
__types?: Types | undefined;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* JSON Schema collection formatted for OpenAPI v3.1 specification.
|
|
134
|
-
*
|
|
135
|
-
* This interface represents a collection of JSON schemas that comply with
|
|
136
|
-
* OpenAPI v3.1 standards, which provide enhanced JSON Schema compatibility
|
|
137
|
-
* and support for modern JSON Schema features. OpenAPI v3.1 is based on JSON
|
|
138
|
-
* Schema Draft 2020-12 and offers significant improvements over v3.0.
|
|
139
|
-
*
|
|
140
|
-
* Key advantages of v3.1:
|
|
141
|
-
*
|
|
142
|
-
* - Full tuple type support with prefixItems
|
|
143
|
-
* - Pattern properties support for dynamic object keys
|
|
144
|
-
* - Proper null type handling via union types
|
|
145
|
-
* - Enhanced JSON Schema Draft 2020-12 compatibility
|
|
146
|
-
* - Better const, enum, and validation support
|
|
147
|
-
*
|
|
148
|
-
* @template Types Array of original TypeScript types used to generate the
|
|
149
|
-
* schemas. This provides compile-time type information about what types
|
|
150
|
-
* were analyzed during schema generation.
|
|
151
|
-
*/
|
|
152
|
-
export interface IV3_1<Types = unknown[]> {
|
|
153
|
-
/**
|
|
154
|
-
* OpenAPI specification version identifier.
|
|
155
|
-
*
|
|
156
|
-
* Always set to "3.1" to indicate this collection uses OpenAPI v3.1 schema
|
|
157
|
-
* format with enhanced JSON Schema compatibility.
|
|
158
|
-
*/
|
|
159
|
-
version: "3.1";
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Reusable schema components for OpenAPI v3.1.
|
|
163
|
-
*
|
|
164
|
-
* Contains reusable schema definitions and other components following the
|
|
165
|
-
* OpenAPI v3.1 specification. This structure is similar to v3.0 but
|
|
166
|
-
* supports enhanced JSON Schema features and improved type definitions.
|
|
167
|
-
*
|
|
168
|
-
* Components include:
|
|
169
|
-
*
|
|
170
|
-
* - Schemas: Named type definitions with enhanced JSON Schema support
|
|
171
|
-
* - SecuritySchemes: Authentication and authorization schemes
|
|
172
|
-
*
|
|
173
|
-
* The emended OpenAPI v3.1 format used here removes ambiguous expressions
|
|
174
|
-
* and standardizes certain patterns for better tooling compatibility.
|
|
175
|
-
*/
|
|
176
|
-
components: OpenApi.IComponents;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Array of generated JSON schemas with v3.1 enhancements.
|
|
180
|
-
*
|
|
181
|
-
* Contains JSON schema definitions that take advantage of OpenAPI v3.1's
|
|
182
|
-
* enhanced capabilities. These schemas can express more complex TypeScript
|
|
183
|
-
* types accurately, including:
|
|
184
|
-
*
|
|
185
|
-
* - Tuple types using prefixItems
|
|
186
|
-
* - Union types with proper null handling
|
|
187
|
-
* - Complex nested object structures
|
|
188
|
-
* - Pattern-based property definitions
|
|
189
|
-
*
|
|
190
|
-
* Each schema corresponds to one of the input TypeScript types and may
|
|
191
|
-
* reference components defined in the {@link components} property.
|
|
192
|
-
*/
|
|
193
|
-
schemas: OpenApi.IJsonSchema[];
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Type metadata for compile-time type tracking.
|
|
197
|
-
*
|
|
198
|
-
* This optional property stores the original TypeScript types that were
|
|
199
|
-
* used to generate the JSON schemas. It provides compile-time type safety
|
|
200
|
-
* and enables better development experience without affecting runtime
|
|
201
|
-
* behavior.
|
|
202
|
-
*
|
|
203
|
-
* Benefits include:
|
|
204
|
-
*
|
|
205
|
-
* - Strong typing connection to original TypeScript definitions
|
|
206
|
-
* - Enhanced IDE support and autocompletion
|
|
207
|
-
* - Compile-time validation of schema usage
|
|
208
|
-
* - Type-safe integration with validation libraries
|
|
209
|
-
*/
|
|
210
|
-
__types?: Types | undefined;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
1
|
+
import type { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collection of JSON schemas with OpenAPI specification support.
|
|
5
|
+
*
|
|
6
|
+
* `IJsonSchemaCollection` represents a comprehensive collection of JSON schemas
|
|
7
|
+
* that can be generated from TypeScript types using the `typia.json.schemas()`
|
|
8
|
+
* function. This interface supports both OpenAPI v3.0 and v3.1 specifications,
|
|
9
|
+
* with the ability to automatically generate appropriate schema definitions
|
|
10
|
+
* based on the specified version.
|
|
11
|
+
*
|
|
12
|
+
* The collection includes:
|
|
13
|
+
*
|
|
14
|
+
* - Generated JSON schemas array containing schema definitions for the specified
|
|
15
|
+
* types
|
|
16
|
+
* - Reusable components that can be referenced across different schemas
|
|
17
|
+
* - Version-specific formatting that adheres to either OpenAPI v3.0 or v3.1
|
|
18
|
+
* standards
|
|
19
|
+
*
|
|
20
|
+
* Key differences between versions:
|
|
21
|
+
*
|
|
22
|
+
* - OpenAPI v3.0: Uses {@link OpenApiV3.IJsonSchema} format with limited tuple
|
|
23
|
+
* support
|
|
24
|
+
* - OpenAPI v3.1: Uses {@link OpenApi.IJsonSchema} format with full JSON Schema
|
|
25
|
+
* Draft 2020-12 compatibility
|
|
26
|
+
*
|
|
27
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Generate schemas for OpenAPI v3.1 (default)
|
|
31
|
+
* const schemas = typia.json.schemas<[User, Product]>();
|
|
32
|
+
* // Type: IJsonSchemaCollection<"3.1", [User, Product]>
|
|
33
|
+
*
|
|
34
|
+
* // Generate schemas for OpenAPI v3.0 (Swagger compatibility)
|
|
35
|
+
* const swaggerSchemas = typia.json.schemas<[User, Product], "3.0">();
|
|
36
|
+
* // Type: IJsonSchemaCollection<"3.0", [User, Product]>
|
|
37
|
+
* ```;
|
|
38
|
+
*
|
|
39
|
+
* @template Version The OpenAPI specification version to target ("3.0" or
|
|
40
|
+
* "3.1"). Defaults to "3.1" for enhanced JSON Schema compatibility.
|
|
41
|
+
* @template Types Array of original TypeScript types that were analyzed to
|
|
42
|
+
* generate the JSON schemas. This provides type safety and traceability back
|
|
43
|
+
* to the source TypeScript definitions.
|
|
44
|
+
*/
|
|
45
|
+
export type IJsonSchemaCollection<
|
|
46
|
+
Version extends "3.0" | "3.1" = "3.1",
|
|
47
|
+
Types = unknown[],
|
|
48
|
+
> = Version extends "3.0"
|
|
49
|
+
? IJsonSchemaCollection.IV3_0<Types>
|
|
50
|
+
: IJsonSchemaCollection.IV3_1<Types>;
|
|
51
|
+
|
|
52
|
+
export namespace IJsonSchemaCollection {
|
|
53
|
+
/**
|
|
54
|
+
* JSON Schema collection formatted for OpenAPI v3.0 specification.
|
|
55
|
+
*
|
|
56
|
+
* This interface represents a collection of JSON schemas that comply with
|
|
57
|
+
* OpenAPI v3.0 standards, which are compatible with Swagger tools and legacy
|
|
58
|
+
* OpenAPI implementations. OpenAPI v3.0 has some limitations compared to
|
|
59
|
+
* v3.1, particularly around tuple types and pattern properties.
|
|
60
|
+
*
|
|
61
|
+
* Key characteristics of v3.0:
|
|
62
|
+
*
|
|
63
|
+
* - Cannot express tuple types natively (falls back to array representations)
|
|
64
|
+
* - Cannot express pattern properties in object schemas
|
|
65
|
+
* - Uses nullable property instead of union with null type
|
|
66
|
+
* - Limited JSON Schema Draft compatibility (based on Draft 4)
|
|
67
|
+
*
|
|
68
|
+
* @template Types Array of original TypeScript types used to generate the
|
|
69
|
+
* schemas. This provides compile-time type information about what types
|
|
70
|
+
* were analyzed during schema generation.
|
|
71
|
+
*/
|
|
72
|
+
export interface IV3_0<Types = unknown[]> {
|
|
73
|
+
/**
|
|
74
|
+
* OpenAPI specification version identifier.
|
|
75
|
+
*
|
|
76
|
+
* Always set to "3.0" to indicate this collection uses OpenAPI v3.0 schema
|
|
77
|
+
* format and constraints.
|
|
78
|
+
*/
|
|
79
|
+
version: "3.0";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Array of generated JSON schemas.
|
|
83
|
+
*
|
|
84
|
+
* Contains the actual JSON schema definitions generated from the input
|
|
85
|
+
* TypeScript types. Each schema in this array corresponds to one of the
|
|
86
|
+
* types specified in the `Types` template parameter. The schemas follow
|
|
87
|
+
* OpenAPI v3.0 format and may contain references to components defined in
|
|
88
|
+
* the {@link components} property.
|
|
89
|
+
*
|
|
90
|
+
* Schema references typically use the format: `{ "$ref":
|
|
91
|
+
* "#/components/schemas/TypeName" }`
|
|
92
|
+
*/
|
|
93
|
+
schemas: OpenApiV3.IJsonSchema[];
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Reusable schema components for OpenAPI v3.0.
|
|
97
|
+
*
|
|
98
|
+
* Contains reusable schema definitions, security schemes, and other
|
|
99
|
+
* components that can be referenced from the main schemas. This follows the
|
|
100
|
+
* OpenAPI v3.0 components structure and enables schema reuse and
|
|
101
|
+
* modularity.
|
|
102
|
+
*
|
|
103
|
+
* Components include:
|
|
104
|
+
*
|
|
105
|
+
* - Schemas: Named type definitions that can be referenced via $ref
|
|
106
|
+
* - SecuritySchemes: Authentication and authorization schemes
|
|
107
|
+
* - Parameters: Reusable parameter definitions
|
|
108
|
+
* - RequestBodies: Reusable request body definitions
|
|
109
|
+
* - Responses: Reusable response definitions
|
|
110
|
+
* - Headers: Reusable header definitions
|
|
111
|
+
* - Examples: Reusable example definitions
|
|
112
|
+
*/
|
|
113
|
+
components: OpenApiV3.IComponents;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Type metadata for compile-time type tracking.
|
|
117
|
+
*
|
|
118
|
+
* This optional property stores the original TypeScript types that were
|
|
119
|
+
* used to generate the JSON schemas. It's primarily used for type safety
|
|
120
|
+
* and doesn't affect runtime behavior. The property is marked as optional
|
|
121
|
+
* and undefined to prevent it from appearing in serialized JSON output.
|
|
122
|
+
*
|
|
123
|
+
* This enables:
|
|
124
|
+
*
|
|
125
|
+
* - Compile-time type checking against the original types
|
|
126
|
+
* - IDE intellisense and autocompletion
|
|
127
|
+
* - Type-safe schema validation and usage
|
|
128
|
+
*/
|
|
129
|
+
__types?: Types | undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* JSON Schema collection formatted for OpenAPI v3.1 specification.
|
|
134
|
+
*
|
|
135
|
+
* This interface represents a collection of JSON schemas that comply with
|
|
136
|
+
* OpenAPI v3.1 standards, which provide enhanced JSON Schema compatibility
|
|
137
|
+
* and support for modern JSON Schema features. OpenAPI v3.1 is based on JSON
|
|
138
|
+
* Schema Draft 2020-12 and offers significant improvements over v3.0.
|
|
139
|
+
*
|
|
140
|
+
* Key advantages of v3.1:
|
|
141
|
+
*
|
|
142
|
+
* - Full tuple type support with prefixItems
|
|
143
|
+
* - Pattern properties support for dynamic object keys
|
|
144
|
+
* - Proper null type handling via union types
|
|
145
|
+
* - Enhanced JSON Schema Draft 2020-12 compatibility
|
|
146
|
+
* - Better const, enum, and validation support
|
|
147
|
+
*
|
|
148
|
+
* @template Types Array of original TypeScript types used to generate the
|
|
149
|
+
* schemas. This provides compile-time type information about what types
|
|
150
|
+
* were analyzed during schema generation.
|
|
151
|
+
*/
|
|
152
|
+
export interface IV3_1<Types = unknown[]> {
|
|
153
|
+
/**
|
|
154
|
+
* OpenAPI specification version identifier.
|
|
155
|
+
*
|
|
156
|
+
* Always set to "3.1" to indicate this collection uses OpenAPI v3.1 schema
|
|
157
|
+
* format with enhanced JSON Schema compatibility.
|
|
158
|
+
*/
|
|
159
|
+
version: "3.1";
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Reusable schema components for OpenAPI v3.1.
|
|
163
|
+
*
|
|
164
|
+
* Contains reusable schema definitions and other components following the
|
|
165
|
+
* OpenAPI v3.1 specification. This structure is similar to v3.0 but
|
|
166
|
+
* supports enhanced JSON Schema features and improved type definitions.
|
|
167
|
+
*
|
|
168
|
+
* Components include:
|
|
169
|
+
*
|
|
170
|
+
* - Schemas: Named type definitions with enhanced JSON Schema support
|
|
171
|
+
* - SecuritySchemes: Authentication and authorization schemes
|
|
172
|
+
*
|
|
173
|
+
* The emended OpenAPI v3.1 format used here removes ambiguous expressions
|
|
174
|
+
* and standardizes certain patterns for better tooling compatibility.
|
|
175
|
+
*/
|
|
176
|
+
components: OpenApi.IComponents;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Array of generated JSON schemas with v3.1 enhancements.
|
|
180
|
+
*
|
|
181
|
+
* Contains JSON schema definitions that take advantage of OpenAPI v3.1's
|
|
182
|
+
* enhanced capabilities. These schemas can express more complex TypeScript
|
|
183
|
+
* types accurately, including:
|
|
184
|
+
*
|
|
185
|
+
* - Tuple types using prefixItems
|
|
186
|
+
* - Union types with proper null handling
|
|
187
|
+
* - Complex nested object structures
|
|
188
|
+
* - Pattern-based property definitions
|
|
189
|
+
*
|
|
190
|
+
* Each schema corresponds to one of the input TypeScript types and may
|
|
191
|
+
* reference components defined in the {@link components} property.
|
|
192
|
+
*/
|
|
193
|
+
schemas: OpenApi.IJsonSchema[];
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Type metadata for compile-time type tracking.
|
|
197
|
+
*
|
|
198
|
+
* This optional property stores the original TypeScript types that were
|
|
199
|
+
* used to generate the JSON schemas. It provides compile-time type safety
|
|
200
|
+
* and enables better development experience without affecting runtime
|
|
201
|
+
* behavior.
|
|
202
|
+
*
|
|
203
|
+
* Benefits include:
|
|
204
|
+
*
|
|
205
|
+
* - Strong typing connection to original TypeScript definitions
|
|
206
|
+
* - Enhanced IDE support and autocompletion
|
|
207
|
+
* - Compile-time validation of schema usage
|
|
208
|
+
* - Type-safe integration with validation libraries
|
|
209
|
+
*/
|
|
210
|
+
__types?: Types | undefined;
|
|
211
|
+
}
|
|
212
|
+
}
|