@typia/interface 12.0.0-dev.20260315 → 12.0.0
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 +29 -29
- package/package.json +1 -1
- package/src/http/IHttpLlmApplication.ts +72 -72
- package/src/http/IHttpLlmFunction.ts +34 -34
- package/src/http/IHttpMigrateApplication.ts +48 -48
- package/src/http/IHttpMigrateRoute.ts +165 -165
- package/src/openapi/OpenApi.ts +680 -680
- package/src/openapi/OpenApiV3.ts +663 -663
- package/src/openapi/OpenApiV3_1.ts +743 -743
- package/src/openapi/OpenApiV3_2.ts +773 -773
- package/src/openapi/SwaggerV2.ts +567 -567
- package/src/openapi/index.ts +5 -5
- package/src/schema/IJsonParseResult.ts +134 -134
- package/src/schema/ILlmApplication.ts +98 -98
- package/src/schema/ILlmSchema.ts +473 -473
- package/src/schema/ILlmStructuredOutput.ts +112 -112
- package/src/schema/index.ts +15 -15
package/src/openapi/OpenApi.ts
CHANGED
|
@@ -1,680 +1,680 @@
|
|
|
1
|
-
import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
|
|
2
|
-
import * as tags from "../tags";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Emended OpenAPI v3.2 specification.
|
|
6
|
-
*
|
|
7
|
-
* `OpenApi` is a refined OpenAPI v3.2 specification that normalizes ambiguous
|
|
8
|
-
* and redundant expressions from various OpenAPI versions (Swagger 2.0, OpenAPI
|
|
9
|
-
* 3.0, 3.1, 3.2). This unified format simplifies schema processing for `typia`
|
|
10
|
-
* and `@nestia/sdk`.
|
|
11
|
-
*
|
|
12
|
-
* Key simplifications:
|
|
13
|
-
*
|
|
14
|
-
* - Schema `$ref` references are unified to `#/components/schemas/{name}` format
|
|
15
|
-
* - Non-schema references (parameters, responses) are resolved inline
|
|
16
|
-
* - `nullable` is converted to `{ oneOf: [schema, { type: "null\" }] }`
|
|
17
|
-
* - `allOf` compositions are merged into single schemas
|
|
18
|
-
* - Schema attributes are normalized across all versions
|
|
19
|
-
*
|
|
20
|
-
* Use `HttpLlm.application()` from `@typia/utils` to convert
|
|
21
|
-
* `OpenApi.IDocument` into {@link IHttpLlmApplication} for LLM function
|
|
22
|
-
* calling.
|
|
23
|
-
*
|
|
24
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
25
|
-
*/
|
|
26
|
-
export namespace OpenApi {
|
|
27
|
-
/**
|
|
28
|
-
* HTTP method supported by OpenAPI operations.
|
|
29
|
-
*
|
|
30
|
-
* Standard HTTP methods used in REST APIs. Each path can have multiple
|
|
31
|
-
* operations, one per HTTP method.
|
|
32
|
-
*/
|
|
33
|
-
export type Method =
|
|
34
|
-
| "get"
|
|
35
|
-
| "post"
|
|
36
|
-
| "put"
|
|
37
|
-
| "delete"
|
|
38
|
-
| "options"
|
|
39
|
-
| "head"
|
|
40
|
-
| "patch"
|
|
41
|
-
| "trace"
|
|
42
|
-
| "query";
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Root document structure for emended OpenAPI v3.2.
|
|
46
|
-
*
|
|
47
|
-
* Contains all API metadata, paths, operations, and reusable components. The
|
|
48
|
-
* `x-samchon-emended-v4` marker indicates this document has been processed by
|
|
49
|
-
* `samchon/typia` to normalize schema formats.
|
|
50
|
-
*/
|
|
51
|
-
export interface IDocument {
|
|
52
|
-
/** OpenAPI version. */
|
|
53
|
-
openapi: `3.2.${number}`;
|
|
54
|
-
|
|
55
|
-
/** List of servers providing the API. */
|
|
56
|
-
servers?: IServer[];
|
|
57
|
-
|
|
58
|
-
/** API metadata. */
|
|
59
|
-
info?: IDocument.IInfo;
|
|
60
|
-
|
|
61
|
-
/** Reusable components (schemas, security schemes). */
|
|
62
|
-
components: IComponents;
|
|
63
|
-
|
|
64
|
-
/** Available API paths and operations. */
|
|
65
|
-
paths?: Record<string, IPath>;
|
|
66
|
-
|
|
67
|
-
/** Webhook definitions. */
|
|
68
|
-
webhooks?: Record<string, IPath>;
|
|
69
|
-
|
|
70
|
-
/** Global security requirements. */
|
|
71
|
-
security?: Record<string, string[]>[];
|
|
72
|
-
|
|
73
|
-
/** Tag definitions for grouping operations. */
|
|
74
|
-
tags?: IDocument.ITag[];
|
|
75
|
-
|
|
76
|
-
/** Marker for emended document by `typia` */
|
|
77
|
-
"x-typia-emended-v12": true;
|
|
78
|
-
}
|
|
79
|
-
export namespace IDocument {
|
|
80
|
-
/**
|
|
81
|
-
* API metadata and identification.
|
|
82
|
-
*
|
|
83
|
-
* Contains essential information about the API including title, version,
|
|
84
|
-
* contact information, and licensing details.
|
|
85
|
-
*/
|
|
86
|
-
export interface IInfo {
|
|
87
|
-
/** API title. */
|
|
88
|
-
title: string;
|
|
89
|
-
|
|
90
|
-
/** Short summary. */
|
|
91
|
-
summary?: string;
|
|
92
|
-
|
|
93
|
-
/** Full description. */
|
|
94
|
-
description?: string;
|
|
95
|
-
|
|
96
|
-
/** Terms of service URL. */
|
|
97
|
-
termsOfService?: string;
|
|
98
|
-
|
|
99
|
-
/** Contact information. */
|
|
100
|
-
contact?: IContact;
|
|
101
|
-
|
|
102
|
-
/** License information. */
|
|
103
|
-
license?: ILicense;
|
|
104
|
-
|
|
105
|
-
/** API version. */
|
|
106
|
-
version: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** Tag for grouping operations. */
|
|
110
|
-
export interface ITag {
|
|
111
|
-
/** Tag name. */
|
|
112
|
-
name: string;
|
|
113
|
-
|
|
114
|
-
/** Short summary for display in tag lists. */
|
|
115
|
-
summary?: string;
|
|
116
|
-
|
|
117
|
-
/** Tag description. */
|
|
118
|
-
description?: string;
|
|
119
|
-
|
|
120
|
-
/** Parent tag name for hierarchical organization. */
|
|
121
|
-
parent?: string;
|
|
122
|
-
|
|
123
|
-
/** Tag classification (e.g., "nav", "badge"). */
|
|
124
|
-
kind?: string;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Contact information. */
|
|
128
|
-
export interface IContact {
|
|
129
|
-
/** Contact name. */
|
|
130
|
-
name?: string;
|
|
131
|
-
|
|
132
|
-
/** Contact URL. */
|
|
133
|
-
url?: string;
|
|
134
|
-
|
|
135
|
-
/** Contact email. */
|
|
136
|
-
email?: string & tags.Format<"email">;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** License information. */
|
|
140
|
-
export interface ILicense {
|
|
141
|
-
/** License name. */
|
|
142
|
-
name: string;
|
|
143
|
-
|
|
144
|
-
/** SPDX license identifier. */
|
|
145
|
-
identifier?: string;
|
|
146
|
-
|
|
147
|
-
/** License URL. */
|
|
148
|
-
url?: string;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/** Server providing the API. */
|
|
153
|
-
export interface IServer {
|
|
154
|
-
/** Server URL. */
|
|
155
|
-
url: string;
|
|
156
|
-
|
|
157
|
-
/** Server description. */
|
|
158
|
-
description?: string;
|
|
159
|
-
|
|
160
|
-
/** URL template variables. */
|
|
161
|
-
variables?: Record<string, IServer.IVariable>;
|
|
162
|
-
}
|
|
163
|
-
export namespace IServer {
|
|
164
|
-
/** URL template variable. */
|
|
165
|
-
export interface IVariable {
|
|
166
|
-
/** Default value. */
|
|
167
|
-
default: string;
|
|
168
|
-
|
|
169
|
-
/** Allowed values. */
|
|
170
|
-
enum?: string[];
|
|
171
|
-
|
|
172
|
-
/** Variable description. */
|
|
173
|
-
description?: string;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** Path item containing operations by HTTP method. */
|
|
178
|
-
export interface IPath extends Partial<Record<Method, IOperation>> {
|
|
179
|
-
/** Path-level servers. */
|
|
180
|
-
servers?: IServer[];
|
|
181
|
-
|
|
182
|
-
/** Path summary. */
|
|
183
|
-
summary?: string;
|
|
184
|
-
|
|
185
|
-
/** Path description. */
|
|
186
|
-
description?: string;
|
|
187
|
-
|
|
188
|
-
/** Additional non-standard HTTP method operations (e.g., LINK, UNLINK, PURGE). */
|
|
189
|
-
additionalOperations?: Record<string, IOperation>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/** API operation metadata. */
|
|
193
|
-
export interface IOperation {
|
|
194
|
-
/** Unique operation identifier. */
|
|
195
|
-
operationId?: string;
|
|
196
|
-
|
|
197
|
-
/** Operation parameters. */
|
|
198
|
-
parameters?: IOperation.IParameter[];
|
|
199
|
-
|
|
200
|
-
/** Request body. */
|
|
201
|
-
requestBody?: IOperation.IRequestBody;
|
|
202
|
-
|
|
203
|
-
/** Response definitions by status code. */
|
|
204
|
-
responses?: Record<string, IOperation.IResponse>;
|
|
205
|
-
|
|
206
|
-
/** Operation-level servers. */
|
|
207
|
-
servers?: IServer[];
|
|
208
|
-
|
|
209
|
-
/** Short summary. */
|
|
210
|
-
summary?: string;
|
|
211
|
-
|
|
212
|
-
/** Full description. */
|
|
213
|
-
description?: string;
|
|
214
|
-
|
|
215
|
-
/** Security requirements. */
|
|
216
|
-
security?: Record<string, string[]>[];
|
|
217
|
-
|
|
218
|
-
/** Operation tags for grouping. */
|
|
219
|
-
tags?: string[];
|
|
220
|
-
|
|
221
|
-
/** Whether deprecated. */
|
|
222
|
-
deprecated?: boolean;
|
|
223
|
-
|
|
224
|
-
/** Excludes from LLM function calling when `true`. */
|
|
225
|
-
"x-samchon-human"?: boolean;
|
|
226
|
-
|
|
227
|
-
/** Custom accessor path for migration. */
|
|
228
|
-
"x-samchon-accessor"?: string[];
|
|
229
|
-
|
|
230
|
-
/** Controller name for code generation. */
|
|
231
|
-
"x-samchon-controller"?: string;
|
|
232
|
-
}
|
|
233
|
-
export namespace IOperation {
|
|
234
|
-
/** Operation parameter. */
|
|
235
|
-
export interface IParameter {
|
|
236
|
-
/** Parameter name. */
|
|
237
|
-
name?: string;
|
|
238
|
-
|
|
239
|
-
/** Parameter location. */
|
|
240
|
-
in: "path" | "query" | "querystring" | "header" | "cookie";
|
|
241
|
-
|
|
242
|
-
/** Parameter schema. */
|
|
243
|
-
schema: IJsonSchema;
|
|
244
|
-
|
|
245
|
-
/** Whether required. */
|
|
246
|
-
required?: boolean;
|
|
247
|
-
|
|
248
|
-
/** Parameter description. */
|
|
249
|
-
description?: string;
|
|
250
|
-
|
|
251
|
-
/** Example value. */
|
|
252
|
-
example?: any;
|
|
253
|
-
|
|
254
|
-
/** Named examples. */
|
|
255
|
-
examples?: Record<string, IExample>;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/** Request body. */
|
|
259
|
-
export interface IRequestBody {
|
|
260
|
-
/** Body content by media type. */
|
|
261
|
-
content?: IContent;
|
|
262
|
-
|
|
263
|
-
/** Body description. */
|
|
264
|
-
description?: string;
|
|
265
|
-
|
|
266
|
-
/** Whether required. */
|
|
267
|
-
required?: boolean;
|
|
268
|
-
|
|
269
|
-
/** Nestia encryption flag. */
|
|
270
|
-
"x-nestia-encrypted"?: boolean;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/** Response definition. */
|
|
274
|
-
export interface IResponse {
|
|
275
|
-
/** Response headers. */
|
|
276
|
-
headers?: Record<string, IOperation.IParameter>;
|
|
277
|
-
|
|
278
|
-
/** Response content by media type. */
|
|
279
|
-
content?: IContent;
|
|
280
|
-
|
|
281
|
-
/** Response description. */
|
|
282
|
-
description?: string;
|
|
283
|
-
|
|
284
|
-
/** Nestia encryption flag. */
|
|
285
|
-
"x-nestia-encrypted"?: boolean;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/** Content by media type. */
|
|
289
|
-
export interface IContent extends Partial<
|
|
290
|
-
Record<ContentType, IMediaType>
|
|
291
|
-
> {}
|
|
292
|
-
|
|
293
|
-
/** Media type definition. */
|
|
294
|
-
export interface IMediaType {
|
|
295
|
-
/** Content schema. */
|
|
296
|
-
schema?: IJsonSchema;
|
|
297
|
-
|
|
298
|
-
/** Schema for streaming items (SSE, JSON Lines, etc.). */
|
|
299
|
-
itemSchema?: IJsonSchema;
|
|
300
|
-
|
|
301
|
-
/** Example value. */
|
|
302
|
-
example?: any;
|
|
303
|
-
|
|
304
|
-
/** Named examples. */
|
|
305
|
-
examples?: Record<string, IExample>;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/** Supported content types. */
|
|
309
|
-
export type ContentType =
|
|
310
|
-
| "text/plain"
|
|
311
|
-
| "application/json"
|
|
312
|
-
| "application/x-www-form-url-encoded"
|
|
313
|
-
| "multipart/form-data"
|
|
314
|
-
| "*/*"
|
|
315
|
-
| (string & {});
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/** Example value definition. */
|
|
319
|
-
export interface IExample {
|
|
320
|
-
/** Example summary. */
|
|
321
|
-
summary?: string;
|
|
322
|
-
|
|
323
|
-
/** Example description. */
|
|
324
|
-
description?: string;
|
|
325
|
-
|
|
326
|
-
/** Example value. */
|
|
327
|
-
value?: any;
|
|
328
|
-
|
|
329
|
-
/** External value URL. */
|
|
330
|
-
externalValue?: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/** Reusable components storage. */
|
|
334
|
-
export interface IComponents {
|
|
335
|
-
/** Named schemas. */
|
|
336
|
-
schemas?: Record<string, IJsonSchema>;
|
|
337
|
-
|
|
338
|
-
/** Named security schemes. */
|
|
339
|
-
securitySchemes?: Record<string, ISecurityScheme>;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* JSON Schema type for emended OpenAPI v3.1.
|
|
344
|
-
*
|
|
345
|
-
* Represents all possible JSON Schema types in the normalized OpenAPI format.
|
|
346
|
-
* This is a discriminated union - check the `type` property or use type
|
|
347
|
-
* guards to narrow to specific schema types.
|
|
348
|
-
*
|
|
349
|
-
* Unlike raw JSON Schema, this format:
|
|
350
|
-
*
|
|
351
|
-
* - Uses `oneOf` instead of `anyOf` for union types
|
|
352
|
-
* - Separates `IArray` (homogeneous) from `ITuple` (heterogeneous)
|
|
353
|
-
* - Normalizes nullable types to `oneOf` with null schema
|
|
354
|
-
*/
|
|
355
|
-
export type IJsonSchema =
|
|
356
|
-
| IJsonSchema.IConstant
|
|
357
|
-
| IJsonSchema.IBoolean
|
|
358
|
-
| IJsonSchema.IInteger
|
|
359
|
-
| IJsonSchema.INumber
|
|
360
|
-
| IJsonSchema.IString
|
|
361
|
-
| IJsonSchema.IArray
|
|
362
|
-
| IJsonSchema.ITuple
|
|
363
|
-
| IJsonSchema.IObject
|
|
364
|
-
| IJsonSchema.IReference
|
|
365
|
-
| IJsonSchema.IOneOf
|
|
366
|
-
| IJsonSchema.INull
|
|
367
|
-
| IJsonSchema.IUnknown;
|
|
368
|
-
export namespace IJsonSchema {
|
|
369
|
-
/** Constant value type. */
|
|
370
|
-
export interface IConstant extends IJsonSchemaAttribute {
|
|
371
|
-
/** Constant value. */
|
|
372
|
-
const: boolean | number | string;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/** Boolean type. */
|
|
376
|
-
export interface IBoolean extends IJsonSchemaAttribute.IBoolean {
|
|
377
|
-
/** Default value. */
|
|
378
|
-
default?: boolean;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/** Integer type. */
|
|
382
|
-
export interface IInteger extends IJsonSchemaAttribute.IInteger {
|
|
383
|
-
/** Default value. */
|
|
384
|
-
default?: number & tags.Type<"int64">;
|
|
385
|
-
|
|
386
|
-
/** Minimum value. */
|
|
387
|
-
minimum?: number & tags.Type<"int64">;
|
|
388
|
-
|
|
389
|
-
/** Maximum value. */
|
|
390
|
-
maximum?: number & tags.Type<"int64">;
|
|
391
|
-
|
|
392
|
-
/** Exclusive minimum. */
|
|
393
|
-
exclusiveMinimum?: number & tags.Type<"int64">;
|
|
394
|
-
|
|
395
|
-
/** Exclusive maximum. */
|
|
396
|
-
exclusiveMaximum?: number & tags.Type<"int64">;
|
|
397
|
-
|
|
398
|
-
/** Multiple of constraint. */
|
|
399
|
-
multipleOf?: number & tags.ExclusiveMinimum<0>;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/** Number (double) type. */
|
|
403
|
-
export interface INumber extends IJsonSchemaAttribute.INumber {
|
|
404
|
-
/** Default value. */
|
|
405
|
-
default?: number;
|
|
406
|
-
|
|
407
|
-
/** Minimum value. */
|
|
408
|
-
minimum?: number;
|
|
409
|
-
|
|
410
|
-
/** Maximum value. */
|
|
411
|
-
maximum?: number;
|
|
412
|
-
|
|
413
|
-
/** Exclusive minimum. */
|
|
414
|
-
exclusiveMinimum?: number;
|
|
415
|
-
|
|
416
|
-
/** Exclusive maximum. */
|
|
417
|
-
exclusiveMaximum?: number;
|
|
418
|
-
|
|
419
|
-
/** Multiple of constraint. */
|
|
420
|
-
multipleOf?: number & tags.ExclusiveMinimum<0>;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/** String type. */
|
|
424
|
-
export interface IString extends IJsonSchemaAttribute.IString {
|
|
425
|
-
/** Default value. */
|
|
426
|
-
default?: string;
|
|
427
|
-
|
|
428
|
-
/** String format. */
|
|
429
|
-
format?:
|
|
430
|
-
| "binary"
|
|
431
|
-
| "byte"
|
|
432
|
-
| "password"
|
|
433
|
-
| "regex"
|
|
434
|
-
| "uuid"
|
|
435
|
-
| "email"
|
|
436
|
-
| "hostname"
|
|
437
|
-
| "idn-email"
|
|
438
|
-
| "idn-hostname"
|
|
439
|
-
| "iri"
|
|
440
|
-
| "iri-reference"
|
|
441
|
-
| "ipv4"
|
|
442
|
-
| "ipv6"
|
|
443
|
-
| "uri"
|
|
444
|
-
| "uri-reference"
|
|
445
|
-
| "uri-template"
|
|
446
|
-
| "url"
|
|
447
|
-
| "date-time"
|
|
448
|
-
| "date"
|
|
449
|
-
| "time"
|
|
450
|
-
| "duration"
|
|
451
|
-
| "json-pointer"
|
|
452
|
-
| "relative-json-pointer"
|
|
453
|
-
| (string & {});
|
|
454
|
-
|
|
455
|
-
/** Regex pattern. */
|
|
456
|
-
pattern?: string;
|
|
457
|
-
|
|
458
|
-
/** Content media type. */
|
|
459
|
-
contentMediaType?: string;
|
|
460
|
-
|
|
461
|
-
/** Minimum length. */
|
|
462
|
-
minLength?: number & tags.Type<"uint64">;
|
|
463
|
-
|
|
464
|
-
/** Maximum length. */
|
|
465
|
-
maxLength?: number & tags.Type<"uint64">;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/** Array type. */
|
|
469
|
-
export interface IArray extends IJsonSchemaAttribute.IArray {
|
|
470
|
-
/** Element type. */
|
|
471
|
-
items: IJsonSchema;
|
|
472
|
-
|
|
473
|
-
/** Whether elements must be unique. */
|
|
474
|
-
uniqueItems?: boolean;
|
|
475
|
-
|
|
476
|
-
/** Minimum items. */
|
|
477
|
-
minItems?: number & tags.Type<"uint64">;
|
|
478
|
-
|
|
479
|
-
/** Maximum items. */
|
|
480
|
-
maxItems?: number & tags.Type<"uint64">;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/** Tuple type. */
|
|
484
|
-
export interface ITuple extends IJsonSchemaAttribute {
|
|
485
|
-
/** Type discriminator. */
|
|
486
|
-
type: "array";
|
|
487
|
-
|
|
488
|
-
/** Tuple element types. */
|
|
489
|
-
prefixItems: IJsonSchema[];
|
|
490
|
-
|
|
491
|
-
/** Rest element type or `true` for any. */
|
|
492
|
-
additionalItems?: boolean | IJsonSchema;
|
|
493
|
-
|
|
494
|
-
/** Whether elements must be unique. */
|
|
495
|
-
uniqueItems?: boolean;
|
|
496
|
-
|
|
497
|
-
/** Minimum items. */
|
|
498
|
-
minItems?: number & tags.Type<"uint64">;
|
|
499
|
-
|
|
500
|
-
/** Maximum items. */
|
|
501
|
-
maxItems?: number & tags.Type<"uint64">;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/** Object type. */
|
|
505
|
-
export interface IObject extends IJsonSchemaAttribute.IObject {
|
|
506
|
-
/** Property schemas. */
|
|
507
|
-
properties?: Record<string, IJsonSchema>;
|
|
508
|
-
|
|
509
|
-
/** Additional properties schema or `true` for any. */
|
|
510
|
-
additionalProperties?: boolean | IJsonSchema;
|
|
511
|
-
|
|
512
|
-
/** Required property names. */
|
|
513
|
-
required?: string[];
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/** Reference to named schema. */
|
|
517
|
-
export interface IReference<Key = string> extends IJsonSchemaAttribute {
|
|
518
|
-
/** Reference path (e.g., `#/components/schemas/TypeName`). */
|
|
519
|
-
$ref: Key;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
/** Union type (`oneOf`). */
|
|
523
|
-
export interface IOneOf extends IJsonSchemaAttribute {
|
|
524
|
-
/** Union member schemas. */
|
|
525
|
-
oneOf: Exclude<IJsonSchema, IJsonSchema.IOneOf>[];
|
|
526
|
-
|
|
527
|
-
/** Discriminator for tagged unions. */
|
|
528
|
-
discriminator?: IOneOf.IDiscriminator;
|
|
529
|
-
}
|
|
530
|
-
export namespace IOneOf {
|
|
531
|
-
/** Discriminator for tagged unions. */
|
|
532
|
-
export interface IDiscriminator {
|
|
533
|
-
/** Discriminator property name. */
|
|
534
|
-
propertyName: string;
|
|
535
|
-
|
|
536
|
-
/** Value to schema mapping. */
|
|
537
|
-
mapping?: Record<string, string>;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/** Null type. */
|
|
542
|
-
export interface INull extends IJsonSchemaAttribute.INull {
|
|
543
|
-
/** Default value. */
|
|
544
|
-
default?: null;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/** Unknown (`any`) type. */
|
|
548
|
-
export interface IUnknown extends IJsonSchemaAttribute.IUnknown {
|
|
549
|
-
/** Default value. */
|
|
550
|
-
default?: any;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
/** Security scheme types. */
|
|
555
|
-
export type ISecurityScheme =
|
|
556
|
-
| ISecurityScheme.IApiKey
|
|
557
|
-
| ISecurityScheme.IHttpBasic
|
|
558
|
-
| ISecurityScheme.IHttpBearer
|
|
559
|
-
| ISecurityScheme.IOAuth2
|
|
560
|
-
| ISecurityScheme.IOpenId;
|
|
561
|
-
export namespace ISecurityScheme {
|
|
562
|
-
/** API key authentication. */
|
|
563
|
-
export interface IApiKey {
|
|
564
|
-
/** Scheme type. */
|
|
565
|
-
type: "apiKey";
|
|
566
|
-
|
|
567
|
-
/** Key location. */
|
|
568
|
-
in?: "header" | "query" | "cookie";
|
|
569
|
-
|
|
570
|
-
/** Key name. */
|
|
571
|
-
name?: string;
|
|
572
|
-
|
|
573
|
-
/** Scheme description. */
|
|
574
|
-
description?: string;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/** HTTP basic authentication. */
|
|
578
|
-
export interface IHttpBasic {
|
|
579
|
-
/** Scheme type. */
|
|
580
|
-
type: "http";
|
|
581
|
-
|
|
582
|
-
/** Authentication scheme. */
|
|
583
|
-
scheme: "basic";
|
|
584
|
-
|
|
585
|
-
/** Scheme description. */
|
|
586
|
-
description?: string;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
/** HTTP bearer authentication. */
|
|
590
|
-
export interface IHttpBearer {
|
|
591
|
-
/** Scheme type. */
|
|
592
|
-
type: "http";
|
|
593
|
-
|
|
594
|
-
/** Authentication scheme. */
|
|
595
|
-
scheme: "bearer";
|
|
596
|
-
|
|
597
|
-
/** Bearer token format hint. */
|
|
598
|
-
bearerFormat?: string;
|
|
599
|
-
|
|
600
|
-
/** Scheme description. */
|
|
601
|
-
description?: string;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/** OAuth2 authentication. */
|
|
605
|
-
export interface IOAuth2 {
|
|
606
|
-
/** Scheme type. */
|
|
607
|
-
type: "oauth2";
|
|
608
|
-
|
|
609
|
-
/** OAuth2 flows. */
|
|
610
|
-
flows: IOAuth2.IFlowSet;
|
|
611
|
-
|
|
612
|
-
/** OAuth2 metadata discovery URL. */
|
|
613
|
-
oauth2MetadataUrl?: string;
|
|
614
|
-
|
|
615
|
-
/** Scheme description. */
|
|
616
|
-
description?: string;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
/** OpenID Connect authentication. */
|
|
620
|
-
export interface IOpenId {
|
|
621
|
-
/** Scheme type. */
|
|
622
|
-
type: "openIdConnect";
|
|
623
|
-
|
|
624
|
-
/** OpenID Connect discovery URL. */
|
|
625
|
-
openIdConnectUrl: string;
|
|
626
|
-
|
|
627
|
-
/** Scheme description. */
|
|
628
|
-
description?: string;
|
|
629
|
-
}
|
|
630
|
-
export namespace IOAuth2 {
|
|
631
|
-
/** OAuth2 flow configurations. */
|
|
632
|
-
export interface IFlowSet {
|
|
633
|
-
/** Authorization code flow. */
|
|
634
|
-
authorizationCode?: IFlow;
|
|
635
|
-
|
|
636
|
-
/** Implicit flow. */
|
|
637
|
-
implicit?: Omit<IFlow, "tokenUrl">;
|
|
638
|
-
|
|
639
|
-
/** Password flow. */
|
|
640
|
-
password?: Omit<IFlow, "authorizationUrl">;
|
|
641
|
-
|
|
642
|
-
/** Client credentials flow. */
|
|
643
|
-
clientCredentials?: Omit<IFlow, "authorizationUrl">;
|
|
644
|
-
|
|
645
|
-
/** Device authorization flow. */
|
|
646
|
-
deviceAuthorization?: IDeviceFlow;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
/** OAuth2 flow configuration. */
|
|
650
|
-
export interface IFlow {
|
|
651
|
-
/** Authorization URL. */
|
|
652
|
-
authorizationUrl?: string;
|
|
653
|
-
|
|
654
|
-
/** Token URL. */
|
|
655
|
-
tokenUrl?: string;
|
|
656
|
-
|
|
657
|
-
/** Refresh URL. */
|
|
658
|
-
refreshUrl?: string;
|
|
659
|
-
|
|
660
|
-
/** Available scopes. */
|
|
661
|
-
scopes?: Record<string, string>;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/** OAuth2 device authorization flow. */
|
|
665
|
-
export interface IDeviceFlow {
|
|
666
|
-
/** Device authorization URL. */
|
|
667
|
-
deviceAuthorizationUrl: string;
|
|
668
|
-
|
|
669
|
-
/** Token URL. */
|
|
670
|
-
tokenUrl: string;
|
|
671
|
-
|
|
672
|
-
/** Refresh URL. */
|
|
673
|
-
refreshUrl?: string;
|
|
674
|
-
|
|
675
|
-
/** Available scopes. */
|
|
676
|
-
scopes?: Record<string, string>;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
1
|
+
import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
|
|
2
|
+
import * as tags from "../tags";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Emended OpenAPI v3.2 specification.
|
|
6
|
+
*
|
|
7
|
+
* `OpenApi` is a refined OpenAPI v3.2 specification that normalizes ambiguous
|
|
8
|
+
* and redundant expressions from various OpenAPI versions (Swagger 2.0, OpenAPI
|
|
9
|
+
* 3.0, 3.1, 3.2). This unified format simplifies schema processing for `typia`
|
|
10
|
+
* and `@nestia/sdk`.
|
|
11
|
+
*
|
|
12
|
+
* Key simplifications:
|
|
13
|
+
*
|
|
14
|
+
* - Schema `$ref` references are unified to `#/components/schemas/{name}` format
|
|
15
|
+
* - Non-schema references (parameters, responses) are resolved inline
|
|
16
|
+
* - `nullable` is converted to `{ oneOf: [schema, { type: "null\" }] }`
|
|
17
|
+
* - `allOf` compositions are merged into single schemas
|
|
18
|
+
* - Schema attributes are normalized across all versions
|
|
19
|
+
*
|
|
20
|
+
* Use `HttpLlm.application()` from `@typia/utils` to convert
|
|
21
|
+
* `OpenApi.IDocument` into {@link IHttpLlmApplication} for LLM function
|
|
22
|
+
* calling.
|
|
23
|
+
*
|
|
24
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
25
|
+
*/
|
|
26
|
+
export namespace OpenApi {
|
|
27
|
+
/**
|
|
28
|
+
* HTTP method supported by OpenAPI operations.
|
|
29
|
+
*
|
|
30
|
+
* Standard HTTP methods used in REST APIs. Each path can have multiple
|
|
31
|
+
* operations, one per HTTP method.
|
|
32
|
+
*/
|
|
33
|
+
export type Method =
|
|
34
|
+
| "get"
|
|
35
|
+
| "post"
|
|
36
|
+
| "put"
|
|
37
|
+
| "delete"
|
|
38
|
+
| "options"
|
|
39
|
+
| "head"
|
|
40
|
+
| "patch"
|
|
41
|
+
| "trace"
|
|
42
|
+
| "query";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Root document structure for emended OpenAPI v3.2.
|
|
46
|
+
*
|
|
47
|
+
* Contains all API metadata, paths, operations, and reusable components. The
|
|
48
|
+
* `x-samchon-emended-v4` marker indicates this document has been processed by
|
|
49
|
+
* `samchon/typia` to normalize schema formats.
|
|
50
|
+
*/
|
|
51
|
+
export interface IDocument {
|
|
52
|
+
/** OpenAPI version. */
|
|
53
|
+
openapi: `3.2.${number}`;
|
|
54
|
+
|
|
55
|
+
/** List of servers providing the API. */
|
|
56
|
+
servers?: IServer[];
|
|
57
|
+
|
|
58
|
+
/** API metadata. */
|
|
59
|
+
info?: IDocument.IInfo;
|
|
60
|
+
|
|
61
|
+
/** Reusable components (schemas, security schemes). */
|
|
62
|
+
components: IComponents;
|
|
63
|
+
|
|
64
|
+
/** Available API paths and operations. */
|
|
65
|
+
paths?: Record<string, IPath>;
|
|
66
|
+
|
|
67
|
+
/** Webhook definitions. */
|
|
68
|
+
webhooks?: Record<string, IPath>;
|
|
69
|
+
|
|
70
|
+
/** Global security requirements. */
|
|
71
|
+
security?: Record<string, string[]>[];
|
|
72
|
+
|
|
73
|
+
/** Tag definitions for grouping operations. */
|
|
74
|
+
tags?: IDocument.ITag[];
|
|
75
|
+
|
|
76
|
+
/** Marker for emended document by `typia` */
|
|
77
|
+
"x-typia-emended-v12": true;
|
|
78
|
+
}
|
|
79
|
+
export namespace IDocument {
|
|
80
|
+
/**
|
|
81
|
+
* API metadata and identification.
|
|
82
|
+
*
|
|
83
|
+
* Contains essential information about the API including title, version,
|
|
84
|
+
* contact information, and licensing details.
|
|
85
|
+
*/
|
|
86
|
+
export interface IInfo {
|
|
87
|
+
/** API title. */
|
|
88
|
+
title: string;
|
|
89
|
+
|
|
90
|
+
/** Short summary. */
|
|
91
|
+
summary?: string;
|
|
92
|
+
|
|
93
|
+
/** Full description. */
|
|
94
|
+
description?: string;
|
|
95
|
+
|
|
96
|
+
/** Terms of service URL. */
|
|
97
|
+
termsOfService?: string;
|
|
98
|
+
|
|
99
|
+
/** Contact information. */
|
|
100
|
+
contact?: IContact;
|
|
101
|
+
|
|
102
|
+
/** License information. */
|
|
103
|
+
license?: ILicense;
|
|
104
|
+
|
|
105
|
+
/** API version. */
|
|
106
|
+
version: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Tag for grouping operations. */
|
|
110
|
+
export interface ITag {
|
|
111
|
+
/** Tag name. */
|
|
112
|
+
name: string;
|
|
113
|
+
|
|
114
|
+
/** Short summary for display in tag lists. */
|
|
115
|
+
summary?: string;
|
|
116
|
+
|
|
117
|
+
/** Tag description. */
|
|
118
|
+
description?: string;
|
|
119
|
+
|
|
120
|
+
/** Parent tag name for hierarchical organization. */
|
|
121
|
+
parent?: string;
|
|
122
|
+
|
|
123
|
+
/** Tag classification (e.g., "nav", "badge"). */
|
|
124
|
+
kind?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Contact information. */
|
|
128
|
+
export interface IContact {
|
|
129
|
+
/** Contact name. */
|
|
130
|
+
name?: string;
|
|
131
|
+
|
|
132
|
+
/** Contact URL. */
|
|
133
|
+
url?: string;
|
|
134
|
+
|
|
135
|
+
/** Contact email. */
|
|
136
|
+
email?: string & tags.Format<"email">;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** License information. */
|
|
140
|
+
export interface ILicense {
|
|
141
|
+
/** License name. */
|
|
142
|
+
name: string;
|
|
143
|
+
|
|
144
|
+
/** SPDX license identifier. */
|
|
145
|
+
identifier?: string;
|
|
146
|
+
|
|
147
|
+
/** License URL. */
|
|
148
|
+
url?: string;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Server providing the API. */
|
|
153
|
+
export interface IServer {
|
|
154
|
+
/** Server URL. */
|
|
155
|
+
url: string;
|
|
156
|
+
|
|
157
|
+
/** Server description. */
|
|
158
|
+
description?: string;
|
|
159
|
+
|
|
160
|
+
/** URL template variables. */
|
|
161
|
+
variables?: Record<string, IServer.IVariable>;
|
|
162
|
+
}
|
|
163
|
+
export namespace IServer {
|
|
164
|
+
/** URL template variable. */
|
|
165
|
+
export interface IVariable {
|
|
166
|
+
/** Default value. */
|
|
167
|
+
default: string;
|
|
168
|
+
|
|
169
|
+
/** Allowed values. */
|
|
170
|
+
enum?: string[];
|
|
171
|
+
|
|
172
|
+
/** Variable description. */
|
|
173
|
+
description?: string;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Path item containing operations by HTTP method. */
|
|
178
|
+
export interface IPath extends Partial<Record<Method, IOperation>> {
|
|
179
|
+
/** Path-level servers. */
|
|
180
|
+
servers?: IServer[];
|
|
181
|
+
|
|
182
|
+
/** Path summary. */
|
|
183
|
+
summary?: string;
|
|
184
|
+
|
|
185
|
+
/** Path description. */
|
|
186
|
+
description?: string;
|
|
187
|
+
|
|
188
|
+
/** Additional non-standard HTTP method operations (e.g., LINK, UNLINK, PURGE). */
|
|
189
|
+
additionalOperations?: Record<string, IOperation>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** API operation metadata. */
|
|
193
|
+
export interface IOperation {
|
|
194
|
+
/** Unique operation identifier. */
|
|
195
|
+
operationId?: string;
|
|
196
|
+
|
|
197
|
+
/** Operation parameters. */
|
|
198
|
+
parameters?: IOperation.IParameter[];
|
|
199
|
+
|
|
200
|
+
/** Request body. */
|
|
201
|
+
requestBody?: IOperation.IRequestBody;
|
|
202
|
+
|
|
203
|
+
/** Response definitions by status code. */
|
|
204
|
+
responses?: Record<string, IOperation.IResponse>;
|
|
205
|
+
|
|
206
|
+
/** Operation-level servers. */
|
|
207
|
+
servers?: IServer[];
|
|
208
|
+
|
|
209
|
+
/** Short summary. */
|
|
210
|
+
summary?: string;
|
|
211
|
+
|
|
212
|
+
/** Full description. */
|
|
213
|
+
description?: string;
|
|
214
|
+
|
|
215
|
+
/** Security requirements. */
|
|
216
|
+
security?: Record<string, string[]>[];
|
|
217
|
+
|
|
218
|
+
/** Operation tags for grouping. */
|
|
219
|
+
tags?: string[];
|
|
220
|
+
|
|
221
|
+
/** Whether deprecated. */
|
|
222
|
+
deprecated?: boolean;
|
|
223
|
+
|
|
224
|
+
/** Excludes from LLM function calling when `true`. */
|
|
225
|
+
"x-samchon-human"?: boolean;
|
|
226
|
+
|
|
227
|
+
/** Custom accessor path for migration. */
|
|
228
|
+
"x-samchon-accessor"?: string[];
|
|
229
|
+
|
|
230
|
+
/** Controller name for code generation. */
|
|
231
|
+
"x-samchon-controller"?: string;
|
|
232
|
+
}
|
|
233
|
+
export namespace IOperation {
|
|
234
|
+
/** Operation parameter. */
|
|
235
|
+
export interface IParameter {
|
|
236
|
+
/** Parameter name. */
|
|
237
|
+
name?: string;
|
|
238
|
+
|
|
239
|
+
/** Parameter location. */
|
|
240
|
+
in: "path" | "query" | "querystring" | "header" | "cookie";
|
|
241
|
+
|
|
242
|
+
/** Parameter schema. */
|
|
243
|
+
schema: IJsonSchema;
|
|
244
|
+
|
|
245
|
+
/** Whether required. */
|
|
246
|
+
required?: boolean;
|
|
247
|
+
|
|
248
|
+
/** Parameter description. */
|
|
249
|
+
description?: string;
|
|
250
|
+
|
|
251
|
+
/** Example value. */
|
|
252
|
+
example?: any;
|
|
253
|
+
|
|
254
|
+
/** Named examples. */
|
|
255
|
+
examples?: Record<string, IExample>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Request body. */
|
|
259
|
+
export interface IRequestBody {
|
|
260
|
+
/** Body content by media type. */
|
|
261
|
+
content?: IContent;
|
|
262
|
+
|
|
263
|
+
/** Body description. */
|
|
264
|
+
description?: string;
|
|
265
|
+
|
|
266
|
+
/** Whether required. */
|
|
267
|
+
required?: boolean;
|
|
268
|
+
|
|
269
|
+
/** Nestia encryption flag. */
|
|
270
|
+
"x-nestia-encrypted"?: boolean;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** Response definition. */
|
|
274
|
+
export interface IResponse {
|
|
275
|
+
/** Response headers. */
|
|
276
|
+
headers?: Record<string, IOperation.IParameter>;
|
|
277
|
+
|
|
278
|
+
/** Response content by media type. */
|
|
279
|
+
content?: IContent;
|
|
280
|
+
|
|
281
|
+
/** Response description. */
|
|
282
|
+
description?: string;
|
|
283
|
+
|
|
284
|
+
/** Nestia encryption flag. */
|
|
285
|
+
"x-nestia-encrypted"?: boolean;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Content by media type. */
|
|
289
|
+
export interface IContent extends Partial<
|
|
290
|
+
Record<ContentType, IMediaType>
|
|
291
|
+
> {}
|
|
292
|
+
|
|
293
|
+
/** Media type definition. */
|
|
294
|
+
export interface IMediaType {
|
|
295
|
+
/** Content schema. */
|
|
296
|
+
schema?: IJsonSchema;
|
|
297
|
+
|
|
298
|
+
/** Schema for streaming items (SSE, JSON Lines, etc.). */
|
|
299
|
+
itemSchema?: IJsonSchema;
|
|
300
|
+
|
|
301
|
+
/** Example value. */
|
|
302
|
+
example?: any;
|
|
303
|
+
|
|
304
|
+
/** Named examples. */
|
|
305
|
+
examples?: Record<string, IExample>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** Supported content types. */
|
|
309
|
+
export type ContentType =
|
|
310
|
+
| "text/plain"
|
|
311
|
+
| "application/json"
|
|
312
|
+
| "application/x-www-form-url-encoded"
|
|
313
|
+
| "multipart/form-data"
|
|
314
|
+
| "*/*"
|
|
315
|
+
| (string & {});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** Example value definition. */
|
|
319
|
+
export interface IExample {
|
|
320
|
+
/** Example summary. */
|
|
321
|
+
summary?: string;
|
|
322
|
+
|
|
323
|
+
/** Example description. */
|
|
324
|
+
description?: string;
|
|
325
|
+
|
|
326
|
+
/** Example value. */
|
|
327
|
+
value?: any;
|
|
328
|
+
|
|
329
|
+
/** External value URL. */
|
|
330
|
+
externalValue?: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** Reusable components storage. */
|
|
334
|
+
export interface IComponents {
|
|
335
|
+
/** Named schemas. */
|
|
336
|
+
schemas?: Record<string, IJsonSchema>;
|
|
337
|
+
|
|
338
|
+
/** Named security schemes. */
|
|
339
|
+
securitySchemes?: Record<string, ISecurityScheme>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* JSON Schema type for emended OpenAPI v3.1.
|
|
344
|
+
*
|
|
345
|
+
* Represents all possible JSON Schema types in the normalized OpenAPI format.
|
|
346
|
+
* This is a discriminated union - check the `type` property or use type
|
|
347
|
+
* guards to narrow to specific schema types.
|
|
348
|
+
*
|
|
349
|
+
* Unlike raw JSON Schema, this format:
|
|
350
|
+
*
|
|
351
|
+
* - Uses `oneOf` instead of `anyOf` for union types
|
|
352
|
+
* - Separates `IArray` (homogeneous) from `ITuple` (heterogeneous)
|
|
353
|
+
* - Normalizes nullable types to `oneOf` with null schema
|
|
354
|
+
*/
|
|
355
|
+
export type IJsonSchema =
|
|
356
|
+
| IJsonSchema.IConstant
|
|
357
|
+
| IJsonSchema.IBoolean
|
|
358
|
+
| IJsonSchema.IInteger
|
|
359
|
+
| IJsonSchema.INumber
|
|
360
|
+
| IJsonSchema.IString
|
|
361
|
+
| IJsonSchema.IArray
|
|
362
|
+
| IJsonSchema.ITuple
|
|
363
|
+
| IJsonSchema.IObject
|
|
364
|
+
| IJsonSchema.IReference
|
|
365
|
+
| IJsonSchema.IOneOf
|
|
366
|
+
| IJsonSchema.INull
|
|
367
|
+
| IJsonSchema.IUnknown;
|
|
368
|
+
export namespace IJsonSchema {
|
|
369
|
+
/** Constant value type. */
|
|
370
|
+
export interface IConstant extends IJsonSchemaAttribute {
|
|
371
|
+
/** Constant value. */
|
|
372
|
+
const: boolean | number | string;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Boolean type. */
|
|
376
|
+
export interface IBoolean extends IJsonSchemaAttribute.IBoolean {
|
|
377
|
+
/** Default value. */
|
|
378
|
+
default?: boolean;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** Integer type. */
|
|
382
|
+
export interface IInteger extends IJsonSchemaAttribute.IInteger {
|
|
383
|
+
/** Default value. */
|
|
384
|
+
default?: number & tags.Type<"int64">;
|
|
385
|
+
|
|
386
|
+
/** Minimum value. */
|
|
387
|
+
minimum?: number & tags.Type<"int64">;
|
|
388
|
+
|
|
389
|
+
/** Maximum value. */
|
|
390
|
+
maximum?: number & tags.Type<"int64">;
|
|
391
|
+
|
|
392
|
+
/** Exclusive minimum. */
|
|
393
|
+
exclusiveMinimum?: number & tags.Type<"int64">;
|
|
394
|
+
|
|
395
|
+
/** Exclusive maximum. */
|
|
396
|
+
exclusiveMaximum?: number & tags.Type<"int64">;
|
|
397
|
+
|
|
398
|
+
/** Multiple of constraint. */
|
|
399
|
+
multipleOf?: number & tags.ExclusiveMinimum<0>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Number (double) type. */
|
|
403
|
+
export interface INumber extends IJsonSchemaAttribute.INumber {
|
|
404
|
+
/** Default value. */
|
|
405
|
+
default?: number;
|
|
406
|
+
|
|
407
|
+
/** Minimum value. */
|
|
408
|
+
minimum?: number;
|
|
409
|
+
|
|
410
|
+
/** Maximum value. */
|
|
411
|
+
maximum?: number;
|
|
412
|
+
|
|
413
|
+
/** Exclusive minimum. */
|
|
414
|
+
exclusiveMinimum?: number;
|
|
415
|
+
|
|
416
|
+
/** Exclusive maximum. */
|
|
417
|
+
exclusiveMaximum?: number;
|
|
418
|
+
|
|
419
|
+
/** Multiple of constraint. */
|
|
420
|
+
multipleOf?: number & tags.ExclusiveMinimum<0>;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** String type. */
|
|
424
|
+
export interface IString extends IJsonSchemaAttribute.IString {
|
|
425
|
+
/** Default value. */
|
|
426
|
+
default?: string;
|
|
427
|
+
|
|
428
|
+
/** String format. */
|
|
429
|
+
format?:
|
|
430
|
+
| "binary"
|
|
431
|
+
| "byte"
|
|
432
|
+
| "password"
|
|
433
|
+
| "regex"
|
|
434
|
+
| "uuid"
|
|
435
|
+
| "email"
|
|
436
|
+
| "hostname"
|
|
437
|
+
| "idn-email"
|
|
438
|
+
| "idn-hostname"
|
|
439
|
+
| "iri"
|
|
440
|
+
| "iri-reference"
|
|
441
|
+
| "ipv4"
|
|
442
|
+
| "ipv6"
|
|
443
|
+
| "uri"
|
|
444
|
+
| "uri-reference"
|
|
445
|
+
| "uri-template"
|
|
446
|
+
| "url"
|
|
447
|
+
| "date-time"
|
|
448
|
+
| "date"
|
|
449
|
+
| "time"
|
|
450
|
+
| "duration"
|
|
451
|
+
| "json-pointer"
|
|
452
|
+
| "relative-json-pointer"
|
|
453
|
+
| (string & {});
|
|
454
|
+
|
|
455
|
+
/** Regex pattern. */
|
|
456
|
+
pattern?: string;
|
|
457
|
+
|
|
458
|
+
/** Content media type. */
|
|
459
|
+
contentMediaType?: string;
|
|
460
|
+
|
|
461
|
+
/** Minimum length. */
|
|
462
|
+
minLength?: number & tags.Type<"uint64">;
|
|
463
|
+
|
|
464
|
+
/** Maximum length. */
|
|
465
|
+
maxLength?: number & tags.Type<"uint64">;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** Array type. */
|
|
469
|
+
export interface IArray extends IJsonSchemaAttribute.IArray {
|
|
470
|
+
/** Element type. */
|
|
471
|
+
items: IJsonSchema;
|
|
472
|
+
|
|
473
|
+
/** Whether elements must be unique. */
|
|
474
|
+
uniqueItems?: boolean;
|
|
475
|
+
|
|
476
|
+
/** Minimum items. */
|
|
477
|
+
minItems?: number & tags.Type<"uint64">;
|
|
478
|
+
|
|
479
|
+
/** Maximum items. */
|
|
480
|
+
maxItems?: number & tags.Type<"uint64">;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** Tuple type. */
|
|
484
|
+
export interface ITuple extends IJsonSchemaAttribute {
|
|
485
|
+
/** Type discriminator. */
|
|
486
|
+
type: "array";
|
|
487
|
+
|
|
488
|
+
/** Tuple element types. */
|
|
489
|
+
prefixItems: IJsonSchema[];
|
|
490
|
+
|
|
491
|
+
/** Rest element type or `true` for any. */
|
|
492
|
+
additionalItems?: boolean | IJsonSchema;
|
|
493
|
+
|
|
494
|
+
/** Whether elements must be unique. */
|
|
495
|
+
uniqueItems?: boolean;
|
|
496
|
+
|
|
497
|
+
/** Minimum items. */
|
|
498
|
+
minItems?: number & tags.Type<"uint64">;
|
|
499
|
+
|
|
500
|
+
/** Maximum items. */
|
|
501
|
+
maxItems?: number & tags.Type<"uint64">;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** Object type. */
|
|
505
|
+
export interface IObject extends IJsonSchemaAttribute.IObject {
|
|
506
|
+
/** Property schemas. */
|
|
507
|
+
properties?: Record<string, IJsonSchema>;
|
|
508
|
+
|
|
509
|
+
/** Additional properties schema or `true` for any. */
|
|
510
|
+
additionalProperties?: boolean | IJsonSchema;
|
|
511
|
+
|
|
512
|
+
/** Required property names. */
|
|
513
|
+
required?: string[];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** Reference to named schema. */
|
|
517
|
+
export interface IReference<Key = string> extends IJsonSchemaAttribute {
|
|
518
|
+
/** Reference path (e.g., `#/components/schemas/TypeName`). */
|
|
519
|
+
$ref: Key;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Union type (`oneOf`). */
|
|
523
|
+
export interface IOneOf extends IJsonSchemaAttribute {
|
|
524
|
+
/** Union member schemas. */
|
|
525
|
+
oneOf: Exclude<IJsonSchema, IJsonSchema.IOneOf>[];
|
|
526
|
+
|
|
527
|
+
/** Discriminator for tagged unions. */
|
|
528
|
+
discriminator?: IOneOf.IDiscriminator;
|
|
529
|
+
}
|
|
530
|
+
export namespace IOneOf {
|
|
531
|
+
/** Discriminator for tagged unions. */
|
|
532
|
+
export interface IDiscriminator {
|
|
533
|
+
/** Discriminator property name. */
|
|
534
|
+
propertyName: string;
|
|
535
|
+
|
|
536
|
+
/** Value to schema mapping. */
|
|
537
|
+
mapping?: Record<string, string>;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/** Null type. */
|
|
542
|
+
export interface INull extends IJsonSchemaAttribute.INull {
|
|
543
|
+
/** Default value. */
|
|
544
|
+
default?: null;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** Unknown (`any`) type. */
|
|
548
|
+
export interface IUnknown extends IJsonSchemaAttribute.IUnknown {
|
|
549
|
+
/** Default value. */
|
|
550
|
+
default?: any;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/** Security scheme types. */
|
|
555
|
+
export type ISecurityScheme =
|
|
556
|
+
| ISecurityScheme.IApiKey
|
|
557
|
+
| ISecurityScheme.IHttpBasic
|
|
558
|
+
| ISecurityScheme.IHttpBearer
|
|
559
|
+
| ISecurityScheme.IOAuth2
|
|
560
|
+
| ISecurityScheme.IOpenId;
|
|
561
|
+
export namespace ISecurityScheme {
|
|
562
|
+
/** API key authentication. */
|
|
563
|
+
export interface IApiKey {
|
|
564
|
+
/** Scheme type. */
|
|
565
|
+
type: "apiKey";
|
|
566
|
+
|
|
567
|
+
/** Key location. */
|
|
568
|
+
in?: "header" | "query" | "cookie";
|
|
569
|
+
|
|
570
|
+
/** Key name. */
|
|
571
|
+
name?: string;
|
|
572
|
+
|
|
573
|
+
/** Scheme description. */
|
|
574
|
+
description?: string;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** HTTP basic authentication. */
|
|
578
|
+
export interface IHttpBasic {
|
|
579
|
+
/** Scheme type. */
|
|
580
|
+
type: "http";
|
|
581
|
+
|
|
582
|
+
/** Authentication scheme. */
|
|
583
|
+
scheme: "basic";
|
|
584
|
+
|
|
585
|
+
/** Scheme description. */
|
|
586
|
+
description?: string;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** HTTP bearer authentication. */
|
|
590
|
+
export interface IHttpBearer {
|
|
591
|
+
/** Scheme type. */
|
|
592
|
+
type: "http";
|
|
593
|
+
|
|
594
|
+
/** Authentication scheme. */
|
|
595
|
+
scheme: "bearer";
|
|
596
|
+
|
|
597
|
+
/** Bearer token format hint. */
|
|
598
|
+
bearerFormat?: string;
|
|
599
|
+
|
|
600
|
+
/** Scheme description. */
|
|
601
|
+
description?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/** OAuth2 authentication. */
|
|
605
|
+
export interface IOAuth2 {
|
|
606
|
+
/** Scheme type. */
|
|
607
|
+
type: "oauth2";
|
|
608
|
+
|
|
609
|
+
/** OAuth2 flows. */
|
|
610
|
+
flows: IOAuth2.IFlowSet;
|
|
611
|
+
|
|
612
|
+
/** OAuth2 metadata discovery URL. */
|
|
613
|
+
oauth2MetadataUrl?: string;
|
|
614
|
+
|
|
615
|
+
/** Scheme description. */
|
|
616
|
+
description?: string;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** OpenID Connect authentication. */
|
|
620
|
+
export interface IOpenId {
|
|
621
|
+
/** Scheme type. */
|
|
622
|
+
type: "openIdConnect";
|
|
623
|
+
|
|
624
|
+
/** OpenID Connect discovery URL. */
|
|
625
|
+
openIdConnectUrl: string;
|
|
626
|
+
|
|
627
|
+
/** Scheme description. */
|
|
628
|
+
description?: string;
|
|
629
|
+
}
|
|
630
|
+
export namespace IOAuth2 {
|
|
631
|
+
/** OAuth2 flow configurations. */
|
|
632
|
+
export interface IFlowSet {
|
|
633
|
+
/** Authorization code flow. */
|
|
634
|
+
authorizationCode?: IFlow;
|
|
635
|
+
|
|
636
|
+
/** Implicit flow. */
|
|
637
|
+
implicit?: Omit<IFlow, "tokenUrl">;
|
|
638
|
+
|
|
639
|
+
/** Password flow. */
|
|
640
|
+
password?: Omit<IFlow, "authorizationUrl">;
|
|
641
|
+
|
|
642
|
+
/** Client credentials flow. */
|
|
643
|
+
clientCredentials?: Omit<IFlow, "authorizationUrl">;
|
|
644
|
+
|
|
645
|
+
/** Device authorization flow. */
|
|
646
|
+
deviceAuthorization?: IDeviceFlow;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/** OAuth2 flow configuration. */
|
|
650
|
+
export interface IFlow {
|
|
651
|
+
/** Authorization URL. */
|
|
652
|
+
authorizationUrl?: string;
|
|
653
|
+
|
|
654
|
+
/** Token URL. */
|
|
655
|
+
tokenUrl?: string;
|
|
656
|
+
|
|
657
|
+
/** Refresh URL. */
|
|
658
|
+
refreshUrl?: string;
|
|
659
|
+
|
|
660
|
+
/** Available scopes. */
|
|
661
|
+
scopes?: Record<string, string>;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** OAuth2 device authorization flow. */
|
|
665
|
+
export interface IDeviceFlow {
|
|
666
|
+
/** Device authorization URL. */
|
|
667
|
+
deviceAuthorizationUrl: string;
|
|
668
|
+
|
|
669
|
+
/** Token URL. */
|
|
670
|
+
tokenUrl: string;
|
|
671
|
+
|
|
672
|
+
/** Refresh URL. */
|
|
673
|
+
refreshUrl?: string;
|
|
674
|
+
|
|
675
|
+
/** Available scopes. */
|
|
676
|
+
scopes?: Record<string, string>;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|