@typia/interface 12.0.0-dev.20260307-2 → 12.0.0-dev.20260310
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/lib/http/IHttpLlmController.d.ts +5 -5
- package/lib/schema/IJsonParseResult.d.ts +1 -3
- package/lib/schema/ILlmApplication.d.ts +1 -1
- package/lib/schema/ILlmController.d.ts +2 -5
- package/lib/schema/ILlmFunction.d.ts +35 -9
- package/package.json +1 -1
- package/src/http/IHttpConnection.ts +200 -200
- package/src/http/IHttpLlmApplication.ts +72 -72
- package/src/http/IHttpLlmController.ts +96 -96
- package/src/http/IHttpLlmFunction.ts +34 -34
- package/src/http/IHttpMigrateApplication.ts +48 -48
- package/src/http/IHttpMigrateRoute.ts +165 -165
- package/src/http/IHttpResponse.ts +42 -42
- package/src/http/index.ts +7 -7
- package/src/index.ts +9 -9
- package/src/metadata/IJsDocTagInfo.ts +25 -25
- package/src/metadata/IMetadataComponents.ts +24 -24
- package/src/metadata/IMetadataSchema.ts +293 -293
- package/src/metadata/IMetadataSchemaCollection.ts +20 -20
- package/src/metadata/IMetadataSchemaUnit.ts +20 -20
- package/src/metadata/IMetadataTypeTag.ts +39 -39
- package/src/metadata/index.ts +6 -6
- package/src/openapi/OpenApi.ts +643 -643
- package/src/openapi/OpenApiV3.ts +655 -655
- package/src/openapi/OpenApiV3_1.ts +735 -735
- package/src/openapi/SwaggerV2.ts +559 -559
- package/src/openapi/index.ts +4 -4
- package/src/protobuf/ProtobufWire.ts +51 -51
- package/src/protobuf/index.ts +1 -1
- package/src/schema/IJsonParseResult.ts +134 -136
- package/src/schema/IJsonSchemaApplication.ts +274 -274
- package/src/schema/IJsonSchemaAttribute.ts +158 -158
- package/src/schema/IJsonSchemaCollection.ts +123 -123
- package/src/schema/IJsonSchemaTransformError.ts +86 -86
- package/src/schema/IJsonSchemaUnit.ts +120 -120
- package/src/schema/ILlmApplication.ts +99 -99
- package/src/schema/ILlmController.ts +54 -57
- package/src/schema/ILlmFunction.ts +145 -118
- package/src/schema/ILlmSchema.ts +484 -484
- package/src/schema/IResult.ts +84 -84
- package/src/schema/IValidation.ts +134 -134
- package/src/schema/index.ts +14 -14
- package/src/tags/Constant.ts +49 -49
- package/src/tags/ContentMediaType.ts +40 -40
- package/src/tags/Default.ts +50 -50
- package/src/tags/Example.ts +48 -48
- package/src/tags/Examples.ts +50 -50
- package/src/tags/ExclusiveMaximum.ts +46 -46
- package/src/tags/ExclusiveMinimum.ts +46 -46
- package/src/tags/Format.ts +76 -76
- package/src/tags/JsonSchemaPlugin.ts +45 -45
- package/src/tags/MaxItems.ts +39 -39
- package/src/tags/MaxLength.ts +37 -37
- package/src/tags/Maximum.ts +44 -44
- package/src/tags/MinItems.ts +39 -39
- package/src/tags/MinLength.ts +37 -37
- package/src/tags/Minimum.ts +44 -44
- package/src/tags/MultipleOf.ts +54 -54
- package/src/tags/Pattern.ts +59 -59
- package/src/tags/Sequence.ts +43 -43
- package/src/tags/TagBase.ts +131 -131
- package/src/tags/Type.ts +70 -70
- package/src/tags/UniqueItems.ts +44 -44
- package/src/tags/index.ts +21 -21
- package/src/typings/AssertionGuard.ts +12 -12
- package/src/typings/Atomic.ts +21 -21
- package/src/typings/CamelCase.ts +75 -75
- package/src/typings/ClassProperties.ts +15 -15
- package/src/typings/DeepPartial.ts +39 -39
- package/src/typings/OmitNever.ts +12 -12
- package/src/typings/PascalCase.ts +71 -71
- package/src/typings/Primitive.ts +71 -71
- package/src/typings/ProtobufAtomic.ts +30 -30
- package/src/typings/Resolved.ts +58 -58
- package/src/typings/SnakeCase.ts +126 -126
- package/src/typings/SpecialFields.ts +13 -13
- package/src/typings/ValidationPipe.ts +20 -20
- package/src/typings/index.ts +14 -14
- package/src/typings/internal/Equal.ts +14 -14
- package/src/typings/internal/IsTuple.ts +17 -17
- package/src/typings/internal/NativeClass.ts +31 -31
- package/src/typings/internal/ValueOf.ts +29 -29
- package/src/utils/IRandomGenerator.ts +105 -105
- package/src/utils/IReadableURLSearchParams.ts +25 -25
- package/src/utils/index.ts +2 -2
|
@@ -1,274 +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
|
-
}
|
|
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
|
+
}
|