@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.
@@ -1,773 +1,773 @@
1
- import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
2
- import * as tags from "../tags";
3
-
4
- /**
5
- * OpenAPI v3.2 specification types (raw, unemended).
6
- *
7
- * `OpenApiV3_2` contains TypeScript type definitions for raw OpenAPI v3.2
8
- * documents as-is from the specification. Unlike {@link OpenApi}, this preserves
9
- * the original structure including `$ref` references and `allOf` compositions
10
- * without normalization.
11
- *
12
- * Key features in v3.2:
13
- *
14
- * - `query` HTTP method for safe read operations with request body
15
- * - `additionalOperations` for non-standard HTTP methods (LINK, UNLINK, etc.)
16
- * - `in: "querystring"` parameter location for full query schema
17
- * - Enhanced Tag structure with `summary`, `parent`, `kind`
18
- * - `itemSchema` for streaming (SSE, JSON Lines, etc.)
19
- * - OAuth2 Device Authorization Flow
20
- *
21
- * For a normalized format that simplifies schema processing, use
22
- * {@link OpenApi}.
23
- *
24
- * @author Jeongho Nam - https://github.com/samchon
25
- */
26
- export namespace OpenApiV3_2 {
27
- /** HTTP method of the operation. */
28
- export type Method =
29
- | "get"
30
- | "post"
31
- | "put"
32
- | "delete"
33
- | "options"
34
- | "head"
35
- | "patch"
36
- | "trace"
37
- | "query";
38
-
39
- /* -----------------------------------------------------------
40
- DOCUMENTS
41
- ----------------------------------------------------------- */
42
- /** OpenAPI document structure. */
43
- export interface IDocument {
44
- /** OpenAPI version. */
45
- openapi: `3.2.${number}`;
46
-
47
- /** List of servers. */
48
- servers?: IServer[];
49
-
50
- /** API metadata. */
51
- info?: IDocument.IInfo;
52
-
53
- /** Reusable components. */
54
- components?: IComponents;
55
-
56
- /** API paths and operations. */
57
- paths?: Record<string, IPath>;
58
-
59
- /** Webhook definitions. */
60
- webhooks?: Record<
61
- string,
62
- IJsonSchema.IReference<`#/components/pathItems/${string}`> | IPath
63
- >;
64
-
65
- /** Global security requirements. */
66
- security?: Record<string, string[]>[];
67
-
68
- /** Tag definitions. */
69
- tags?: IDocument.ITag[];
70
- }
71
- export namespace IDocument {
72
- /** API metadata. */
73
- export interface IInfo {
74
- /** API title. */
75
- title: string;
76
-
77
- /** Short summary. */
78
- summary?: string;
79
-
80
- /** Full description. */
81
- description?: string;
82
-
83
- /** Terms of service URL. */
84
- termsOfService?: string;
85
-
86
- /** Contact information. */
87
- contact?: IContact;
88
-
89
- /** License information. */
90
- license?: ILicense;
91
-
92
- /** API version. */
93
- version: string;
94
- }
95
-
96
- /** Tag for grouping operations. */
97
- export interface ITag {
98
- /** Tag name. */
99
- name: string;
100
-
101
- /** Short summary for display in tag lists. */
102
- summary?: string;
103
-
104
- /** Tag description. */
105
- description?: string;
106
-
107
- /** Parent tag name for hierarchical organization. */
108
- parent?: string;
109
-
110
- /** Tag classification (e.g., "nav", "badge"). */
111
- kind?: string;
112
- }
113
-
114
- /** Contact information. */
115
- export interface IContact {
116
- /** Contact name. */
117
- name?: string;
118
-
119
- /** Contact URL. */
120
- url?: string;
121
-
122
- /** Contact email. */
123
- email?: string & tags.Format<"email">;
124
- }
125
-
126
- /** License information. */
127
- export interface ILicense {
128
- /** License name. */
129
- name: string;
130
-
131
- /** SPDX license identifier. */
132
- identifier?: string;
133
-
134
- /** License URL. */
135
- url?: string;
136
- }
137
- }
138
-
139
- /** Server providing the API. */
140
- export interface IServer {
141
- /** Server URL. */
142
- url: string;
143
-
144
- /** Server description. */
145
- description?: string;
146
-
147
- /** URL template variables. */
148
- variables?: Record<string, IServer.IVariable>;
149
- }
150
- export namespace IServer {
151
- /** URL template variable. */
152
- export interface IVariable {
153
- /** Default value. */
154
- default: string;
155
-
156
- /** Allowed values. @minItems 1 */
157
- enum?: string[];
158
-
159
- /** Variable description. */
160
- description?: string;
161
- }
162
- }
163
-
164
- /* -----------------------------------------------------------
165
- OPERATORS
166
- ----------------------------------------------------------- */
167
- /** Path item containing operations by HTTP method. */
168
- export interface IPath extends Partial<Record<Method, IOperation>> {
169
- /** Path-level parameters. */
170
- parameters?: Array<
171
- | IOperation.IParameter
172
- | IJsonSchema.IReference<`#/components/headers/${string}`>
173
- | IJsonSchema.IReference<`#/components/parameters/${string}`>
174
- >;
175
-
176
- /** Path-level servers. */
177
- servers?: IServer[];
178
-
179
- /** Path summary. */
180
- summary?: string;
181
-
182
- /** Path description. */
183
- description?: string;
184
-
185
- /** Additional non-standard HTTP method operations (e.g., LINK, UNLINK, PURGE). */
186
- additionalOperations?: Record<string, IOperation>;
187
- }
188
-
189
- /** API operation metadata. */
190
- export interface IOperation {
191
- /** Unique operation identifier. */
192
- operationId?: string;
193
-
194
- /** Operation parameters. */
195
- parameters?: Array<
196
- | IOperation.IParameter
197
- | IJsonSchema.IReference<`#/components/headers/${string}`>
198
- | IJsonSchema.IReference<`#/components/parameters/${string}`>
199
- >;
200
-
201
- /** Request body. */
202
- requestBody?:
203
- | IOperation.IRequestBody
204
- | IJsonSchema.IReference<`#/components/requestBodies/${string}`>;
205
-
206
- /** Response definitions by status code. */
207
- responses?: Record<
208
- string,
209
- | IOperation.IResponse
210
- | IJsonSchema.IReference<`#/components/responses/${string}`>
211
- >;
212
-
213
- /** Operation-level servers. */
214
- servers?: IServer[];
215
-
216
- /** Short summary. */
217
- summary?: string;
218
-
219
- /** Full description. */
220
- description?: string;
221
-
222
- /** Security requirements. */
223
- security?: Record<string, string[]>[];
224
-
225
- /** Operation tags. */
226
- tags?: string[];
227
-
228
- /** Whether deprecated. */
229
- deprecated?: boolean;
230
- }
231
- export namespace IOperation {
232
- /** Operation parameter. */
233
- export interface IParameter {
234
- /** Parameter name. */
235
- name?: string;
236
-
237
- /** Parameter location. */
238
- in: "path" | "query" | "querystring" | "header" | "cookie";
239
-
240
- /** Parameter schema. */
241
- schema: IJsonSchema;
242
-
243
- /** Whether required. */
244
- required?: boolean;
245
-
246
- /** Parameter description. */
247
- description?: string;
248
-
249
- /** Example value. */
250
- example?: any;
251
-
252
- /** Named examples. */
253
- examples?: Record<
254
- string,
255
- IExample | IJsonSchema.IReference<`#/components/examples/${string}`>
256
- >;
257
- }
258
-
259
- /** Request body. */
260
- export interface IRequestBody {
261
- /** Body description. */
262
- description?: string;
263
-
264
- /** Whether required. */
265
- required?: boolean;
266
-
267
- /** Body content by media type. */
268
- content?: Record<string, IMediaType>;
269
- }
270
-
271
- /** Response definition. */
272
- export interface IResponse {
273
- /** Response content by media type. */
274
- content?: Record<string, IMediaType>;
275
-
276
- /** Response headers. */
277
- headers?: Record<
278
- string,
279
- | Omit<IOperation.IParameter, "in">
280
- | IJsonSchema.IReference<`#/components/headers/${string}`>
281
- >;
282
-
283
- /** Response description. */
284
- description?: string;
285
- }
286
-
287
- /** Media type definition. */
288
- export interface IMediaType {
289
- /** Content schema. */
290
- schema?: IJsonSchema;
291
-
292
- /** Schema for streaming items (SSE, JSON Lines, etc.). */
293
- itemSchema?: IJsonSchema;
294
-
295
- /** Example value. */
296
- example?: any;
297
-
298
- /** Named examples. */
299
- examples?: Record<
300
- string,
301
- IExample | IJsonSchema.IReference<`#/components/examples/${string}`>
302
- >;
303
- }
304
- }
305
-
306
- /** Example value definition. */
307
- export interface IExample {
308
- /** Example summary. */
309
- summary?: string;
310
-
311
- /** Example description. */
312
- description?: string;
313
-
314
- /** Example value. */
315
- value?: any;
316
-
317
- /** External value URL. */
318
- externalValue?: string;
319
- }
320
-
321
- /* -----------------------------------------------------------
322
- SCHEMA DEFINITIONS
323
- ----------------------------------------------------------- */
324
- /** Reusable components storage. */
325
- export interface IComponents {
326
- /** Named schemas. */
327
- schemas?: Record<string, IJsonSchema>;
328
-
329
- /** Named path items. */
330
- pathItems?: Record<string, IPath>;
331
-
332
- /** Named responses. */
333
- responses?: Record<string, IOperation.IResponse>;
334
-
335
- /** Named parameters. */
336
- parameters?: Record<string, IOperation.IParameter>;
337
-
338
- /** Named request bodies. */
339
- requestBodies?: Record<string, IOperation.IRequestBody>;
340
-
341
- /** Named security schemes. */
342
- securitySchemes?: Record<string, ISecurityScheme>;
343
-
344
- /** Named headers. */
345
- headers?: Record<string, Omit<IOperation.IParameter, "in">>;
346
-
347
- /** Named examples. */
348
- examples?: Record<string, IExample>;
349
- }
350
-
351
- /** JSON Schema type for OpenAPI v3.1. */
352
- export type IJsonSchema =
353
- | IJsonSchema.IMixed
354
- | IJsonSchema.IConstant
355
- | IJsonSchema.IBoolean
356
- | IJsonSchema.IInteger
357
- | IJsonSchema.INumber
358
- | IJsonSchema.IString
359
- | IJsonSchema.IArray
360
- | IJsonSchema.IObject
361
- | IJsonSchema.IReference
362
- | IJsonSchema.IRecursiveReference
363
- | IJsonSchema.IAllOf
364
- | IJsonSchema.IAnyOf
365
- | IJsonSchema.IOneOf
366
- | IJsonSchema.INull
367
- | IJsonSchema.IUnknown;
368
- export namespace IJsonSchema {
369
- /** Mixed type (multiple types in array). */
370
- export interface IMixed
371
- extends
372
- IConstant,
373
- Omit<IBoolean, "type" | "default" | "enum">,
374
- Omit<INumber, "type" | "default" | "enum">,
375
- Omit<IString, "type" | "default" | "enum">,
376
- Omit<IArray, "type">,
377
- Omit<IObject, "type">,
378
- IOneOf,
379
- IAnyOf,
380
- IAllOf,
381
- IReference {
382
- /** Array of type discriminators. */
383
- type: Array<
384
- | "boolean"
385
- | "integer"
386
- | "number"
387
- | "string"
388
- | "array"
389
- | "object"
390
- | "null"
391
- >;
392
-
393
- /** Default value. */
394
- default?: any[] | null;
395
-
396
- /** Allowed values. */
397
- enum?: any[];
398
- }
399
-
400
- /** Constant value type. */
401
- export interface IConstant extends __IAttribute {
402
- /** Constant value. */
403
- const: boolean | number | string;
404
-
405
- /** Whether nullable. */
406
- nullable?: boolean;
407
- }
408
-
409
- /** Boolean type. */
410
- export interface IBoolean
411
- extends Omit<IJsonSchemaAttribute.IBoolean, "examples">, __IAttribute {
412
- /** Whether nullable. */
413
- nullable?: boolean;
414
-
415
- /** Default value. */
416
- default?: boolean | null;
417
-
418
- /** Allowed values. */
419
- enum?: Array<boolean | null>;
420
- }
421
-
422
- /** Integer type. */
423
- export interface IInteger
424
- extends Omit<IJsonSchemaAttribute.IInteger, "examples">, __IAttribute {
425
- /** Whether nullable. */
426
- nullable?: boolean;
427
-
428
- /** Default value. */
429
- default?: (number & tags.Type<"int64">) | null;
430
-
431
- /** Allowed values. */
432
- enum?: Array<(number & tags.Type<"int64">) | null>;
433
-
434
- /** Minimum value. */
435
- minimum?: number & tags.Type<"int64">;
436
-
437
- /** Maximum value. */
438
- maximum?: number & tags.Type<"int64">;
439
-
440
- /** Exclusive minimum. */
441
- exclusiveMinimum?: (number & tags.Type<"int64">) | boolean;
442
-
443
- /** Exclusive maximum. */
444
- exclusiveMaximum?: (number & tags.Type<"int64">) | boolean;
445
-
446
- /** Multiple of constraint. */
447
- multipleOf?: number & tags.ExclusiveMinimum<0>;
448
- }
449
-
450
- /** Number (double) type. */
451
- export interface INumber
452
- extends Omit<IJsonSchemaAttribute.INumber, "examples">, __IAttribute {
453
- /** Whether nullable. */
454
- nullable?: boolean;
455
-
456
- /** Default value. */
457
- default?: number | null;
458
-
459
- /** Allowed values. */
460
- enum?: Array<number | null>;
461
-
462
- /** Minimum value. */
463
- minimum?: number;
464
-
465
- /** Maximum value. */
466
- maximum?: number;
467
-
468
- /** Exclusive minimum. */
469
- exclusiveMinimum?: number | boolean;
470
-
471
- /** Exclusive maximum. */
472
- exclusiveMaximum?: number | boolean;
473
-
474
- /** Multiple of constraint. */
475
- multipleOf?: number & tags.ExclusiveMinimum<0>;
476
- }
477
-
478
- /** String type. */
479
- export interface IString
480
- extends Omit<IJsonSchemaAttribute.IString, "examples">, __IAttribute {
481
- /** Whether nullable. */
482
- nullable?: boolean;
483
-
484
- /** Default value. */
485
- default?: string | null;
486
-
487
- /** Allowed values. */
488
- enum?: Array<string | null>;
489
-
490
- /** String format. */
491
- format?:
492
- | "binary"
493
- | "byte"
494
- | "password"
495
- | "regex"
496
- | "uuid"
497
- | "email"
498
- | "hostname"
499
- | "idn-email"
500
- | "idn-hostname"
501
- | "iri"
502
- | "iri-reference"
503
- | "ipv4"
504
- | "ipv6"
505
- | "uri"
506
- | "uri-reference"
507
- | "uri-template"
508
- | "url"
509
- | "date-time"
510
- | "date"
511
- | "time"
512
- | "duration"
513
- | "json-pointer"
514
- | "relative-json-pointer"
515
- | (string & {});
516
-
517
- /** Regex pattern. */
518
- pattern?: string;
519
-
520
- /** Content media type. */
521
- contentMediaType?: string;
522
-
523
- /** Minimum length. */
524
- minLength?: number & tags.Type<"uint64">;
525
-
526
- /** Maximum length. */
527
- maxLength?: number & tags.Type<"uint64">;
528
- }
529
-
530
- /** Object type. */
531
- export interface IObject
532
- extends Omit<IJsonSchemaAttribute.IObject, "examples">, __IAttribute {
533
- /** Whether nullable. */
534
- nullable?: boolean;
535
-
536
- /** Property schemas. */
537
- properties?: Record<string, IJsonSchema>;
538
-
539
- /** Required property names. */
540
- required?: string[];
541
-
542
- /** Additional properties schema. */
543
- additionalProperties?: boolean | IJsonSchema;
544
-
545
- /** Maximum properties. */
546
- maxProperties?: number;
547
-
548
- /** Minimum properties. */
549
- minProperties?: number;
550
- }
551
-
552
- /** Array type. */
553
- export interface IArray
554
- extends Omit<IJsonSchemaAttribute.IArray, "examples">, __IAttribute {
555
- /** Whether nullable. */
556
- nullable?: boolean;
557
-
558
- /** Element type (or tuple types). */
559
- items?: IJsonSchema | IJsonSchema[];
560
-
561
- /** Tuple prefix items. */
562
- prefixItems?: IJsonSchema[];
563
-
564
- /** Whether elements must be unique. */
565
- uniqueItems?: boolean;
566
-
567
- /** Additional items schema. */
568
- additionalItems?: boolean | IJsonSchema;
569
-
570
- /** Minimum items. */
571
- minItems?: number & tags.Type<"uint64">;
572
-
573
- /** Maximum items. */
574
- maxItems?: number & tags.Type<"uint64">;
575
- }
576
-
577
- /** Reference to a named schema. */
578
- export interface IReference<Key = string> extends __IAttribute {
579
- /** Reference path. */
580
- $ref: Key;
581
- }
582
-
583
- /** Recursive reference. */
584
- export interface IRecursiveReference extends __IAttribute {
585
- /** Recursive reference path. */
586
- $recursiveRef: string;
587
- }
588
-
589
- /** All-of combination. */
590
- export interface IAllOf extends __IAttribute {
591
- /** Schemas to combine. */
592
- allOf: IJsonSchema[];
593
- }
594
-
595
- /** Any-of union. */
596
- export interface IAnyOf extends __IAttribute {
597
- /** Union member schemas. */
598
- anyOf: IJsonSchema[];
599
- }
600
-
601
- /** One-of union. */
602
- export interface IOneOf extends __IAttribute {
603
- /** Union member schemas. */
604
- oneOf: IJsonSchema[];
605
-
606
- /** Discriminator for tagged unions. */
607
- discriminator?: IOneOf.IDiscriminator;
608
- }
609
- export namespace IOneOf {
610
- /** Discriminator for tagged unions. */
611
- export interface IDiscriminator {
612
- /** Discriminator property name. */
613
- propertyName: string;
614
-
615
- /** Value to schema mapping. */
616
- mapping?: Record<string, string>;
617
- }
618
- }
619
-
620
- /** Null type. */
621
- export interface INull
622
- extends Omit<IJsonSchemaAttribute.INull, "examples">, __IAttribute {
623
- /** Default value. */
624
- default?: null;
625
- }
626
-
627
- /** Unknown type. */
628
- export interface IUnknown
629
- extends Omit<IJsonSchemaAttribute.IUnknown, "examples">, __IAttribute {
630
- /** Type discriminator (undefined for unknown). */
631
- type?: undefined;
632
-
633
- /** Default value. */
634
- default?: any;
635
- }
636
-
637
- /** @internal Base attribute interface. */
638
- export interface __IAttribute extends Omit<
639
- IJsonSchemaAttribute,
640
- "examples"
641
- > {
642
- /** Example values. */
643
- examples?: any[] | Record<string, any>;
644
- }
645
- }
646
-
647
- /** Security scheme types. */
648
- export type ISecurityScheme =
649
- | ISecurityScheme.IApiKey
650
- | ISecurityScheme.IHttpBasic
651
- | ISecurityScheme.IHttpBearer
652
- | ISecurityScheme.IOAuth2
653
- | ISecurityScheme.IOpenId;
654
- export namespace ISecurityScheme {
655
- /** API key authentication. */
656
- export interface IApiKey {
657
- /** Scheme type. */
658
- type: "apiKey";
659
-
660
- /** Key location. */
661
- in?: "header" | "query" | "cookie";
662
-
663
- /** Key name. */
664
- name?: string;
665
-
666
- /** Scheme description. */
667
- description?: string;
668
- }
669
-
670
- /** HTTP basic authentication. */
671
- export interface IHttpBasic {
672
- /** Scheme type. */
673
- type: "http";
674
-
675
- /** Authentication scheme. */
676
- scheme: "basic";
677
-
678
- /** Scheme description. */
679
- description?: string;
680
- }
681
-
682
- /** HTTP bearer authentication. */
683
- export interface IHttpBearer {
684
- /** Scheme type. */
685
- type: "http";
686
-
687
- /** Authentication scheme. */
688
- scheme: "bearer";
689
-
690
- /** Bearer token format hint. */
691
- bearerFormat?: string;
692
-
693
- /** Scheme description. */
694
- description?: string;
695
- }
696
-
697
- /** OAuth2 authentication. */
698
- export interface IOAuth2 {
699
- /** Scheme type. */
700
- type: "oauth2";
701
-
702
- /** OAuth2 flows. */
703
- flows: IOAuth2.IFlowSet;
704
-
705
- /** OAuth2 metadata discovery URL. */
706
- oauth2MetadataUrl?: string;
707
-
708
- /** Scheme description. */
709
- description?: string;
710
- }
711
-
712
- /** OpenID Connect authentication. */
713
- export interface IOpenId {
714
- /** Scheme type. */
715
- type: "openIdConnect";
716
-
717
- /** OpenID Connect discovery URL. */
718
- openIdConnectUrl: string;
719
-
720
- /** Scheme description. */
721
- description?: string;
722
- }
723
- export namespace IOAuth2 {
724
- /** OAuth2 flow configurations. */
725
- export interface IFlowSet {
726
- /** Authorization code flow. */
727
- authorizationCode?: IFlow;
728
-
729
- /** Implicit flow. */
730
- implicit?: Omit<IFlow, "tokenUrl">;
731
-
732
- /** Password flow. */
733
- password?: Omit<IFlow, "authorizationUrl">;
734
-
735
- /** Client credentials flow. */
736
- clientCredentials?: Omit<IFlow, "authorizationUrl">;
737
-
738
- /** Device authorization flow. */
739
- deviceAuthorization?: IDeviceFlow;
740
- }
741
-
742
- /** OAuth2 flow configuration. */
743
- export interface IFlow {
744
- /** Authorization URL. */
745
- authorizationUrl?: string;
746
-
747
- /** Token URL. */
748
- tokenUrl?: string;
749
-
750
- /** Refresh URL. */
751
- refreshUrl?: string;
752
-
753
- /** Available scopes. */
754
- scopes?: Record<string, string>;
755
- }
756
-
757
- /** OAuth2 device authorization flow. */
758
- export interface IDeviceFlow {
759
- /** Device authorization URL. */
760
- deviceAuthorizationUrl: string;
761
-
762
- /** Token URL. */
763
- tokenUrl: string;
764
-
765
- /** Refresh URL. */
766
- refreshUrl?: string;
767
-
768
- /** Available scopes. */
769
- scopes?: Record<string, string>;
770
- }
771
- }
772
- }
773
- }
1
+ import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
2
+ import * as tags from "../tags";
3
+
4
+ /**
5
+ * OpenAPI v3.2 specification types (raw, unemended).
6
+ *
7
+ * `OpenApiV3_2` contains TypeScript type definitions for raw OpenAPI v3.2
8
+ * documents as-is from the specification. Unlike {@link OpenApi}, this preserves
9
+ * the original structure including `$ref` references and `allOf` compositions
10
+ * without normalization.
11
+ *
12
+ * Key features in v3.2:
13
+ *
14
+ * - `query` HTTP method for safe read operations with request body
15
+ * - `additionalOperations` for non-standard HTTP methods (LINK, UNLINK, etc.)
16
+ * - `in: "querystring"` parameter location for full query schema
17
+ * - Enhanced Tag structure with `summary`, `parent`, `kind`
18
+ * - `itemSchema` for streaming (SSE, JSON Lines, etc.)
19
+ * - OAuth2 Device Authorization Flow
20
+ *
21
+ * For a normalized format that simplifies schema processing, use
22
+ * {@link OpenApi}.
23
+ *
24
+ * @author Jeongho Nam - https://github.com/samchon
25
+ */
26
+ export namespace OpenApiV3_2 {
27
+ /** HTTP method of the operation. */
28
+ export type Method =
29
+ | "get"
30
+ | "post"
31
+ | "put"
32
+ | "delete"
33
+ | "options"
34
+ | "head"
35
+ | "patch"
36
+ | "trace"
37
+ | "query";
38
+
39
+ /* -----------------------------------------------------------
40
+ DOCUMENTS
41
+ ----------------------------------------------------------- */
42
+ /** OpenAPI document structure. */
43
+ export interface IDocument {
44
+ /** OpenAPI version. */
45
+ openapi: `3.2.${number}`;
46
+
47
+ /** List of servers. */
48
+ servers?: IServer[];
49
+
50
+ /** API metadata. */
51
+ info?: IDocument.IInfo;
52
+
53
+ /** Reusable components. */
54
+ components?: IComponents;
55
+
56
+ /** API paths and operations. */
57
+ paths?: Record<string, IPath>;
58
+
59
+ /** Webhook definitions. */
60
+ webhooks?: Record<
61
+ string,
62
+ IJsonSchema.IReference<`#/components/pathItems/${string}`> | IPath
63
+ >;
64
+
65
+ /** Global security requirements. */
66
+ security?: Record<string, string[]>[];
67
+
68
+ /** Tag definitions. */
69
+ tags?: IDocument.ITag[];
70
+ }
71
+ export namespace IDocument {
72
+ /** API metadata. */
73
+ export interface IInfo {
74
+ /** API title. */
75
+ title: string;
76
+
77
+ /** Short summary. */
78
+ summary?: string;
79
+
80
+ /** Full description. */
81
+ description?: string;
82
+
83
+ /** Terms of service URL. */
84
+ termsOfService?: string;
85
+
86
+ /** Contact information. */
87
+ contact?: IContact;
88
+
89
+ /** License information. */
90
+ license?: ILicense;
91
+
92
+ /** API version. */
93
+ version: string;
94
+ }
95
+
96
+ /** Tag for grouping operations. */
97
+ export interface ITag {
98
+ /** Tag name. */
99
+ name: string;
100
+
101
+ /** Short summary for display in tag lists. */
102
+ summary?: string;
103
+
104
+ /** Tag description. */
105
+ description?: string;
106
+
107
+ /** Parent tag name for hierarchical organization. */
108
+ parent?: string;
109
+
110
+ /** Tag classification (e.g., "nav", "badge"). */
111
+ kind?: string;
112
+ }
113
+
114
+ /** Contact information. */
115
+ export interface IContact {
116
+ /** Contact name. */
117
+ name?: string;
118
+
119
+ /** Contact URL. */
120
+ url?: string;
121
+
122
+ /** Contact email. */
123
+ email?: string & tags.Format<"email">;
124
+ }
125
+
126
+ /** License information. */
127
+ export interface ILicense {
128
+ /** License name. */
129
+ name: string;
130
+
131
+ /** SPDX license identifier. */
132
+ identifier?: string;
133
+
134
+ /** License URL. */
135
+ url?: string;
136
+ }
137
+ }
138
+
139
+ /** Server providing the API. */
140
+ export interface IServer {
141
+ /** Server URL. */
142
+ url: string;
143
+
144
+ /** Server description. */
145
+ description?: string;
146
+
147
+ /** URL template variables. */
148
+ variables?: Record<string, IServer.IVariable>;
149
+ }
150
+ export namespace IServer {
151
+ /** URL template variable. */
152
+ export interface IVariable {
153
+ /** Default value. */
154
+ default: string;
155
+
156
+ /** Allowed values. @minItems 1 */
157
+ enum?: string[];
158
+
159
+ /** Variable description. */
160
+ description?: string;
161
+ }
162
+ }
163
+
164
+ /* -----------------------------------------------------------
165
+ OPERATORS
166
+ ----------------------------------------------------------- */
167
+ /** Path item containing operations by HTTP method. */
168
+ export interface IPath extends Partial<Record<Method, IOperation>> {
169
+ /** Path-level parameters. */
170
+ parameters?: Array<
171
+ | IOperation.IParameter
172
+ | IJsonSchema.IReference<`#/components/headers/${string}`>
173
+ | IJsonSchema.IReference<`#/components/parameters/${string}`>
174
+ >;
175
+
176
+ /** Path-level servers. */
177
+ servers?: IServer[];
178
+
179
+ /** Path summary. */
180
+ summary?: string;
181
+
182
+ /** Path description. */
183
+ description?: string;
184
+
185
+ /** Additional non-standard HTTP method operations (e.g., LINK, UNLINK, PURGE). */
186
+ additionalOperations?: Record<string, IOperation>;
187
+ }
188
+
189
+ /** API operation metadata. */
190
+ export interface IOperation {
191
+ /** Unique operation identifier. */
192
+ operationId?: string;
193
+
194
+ /** Operation parameters. */
195
+ parameters?: Array<
196
+ | IOperation.IParameter
197
+ | IJsonSchema.IReference<`#/components/headers/${string}`>
198
+ | IJsonSchema.IReference<`#/components/parameters/${string}`>
199
+ >;
200
+
201
+ /** Request body. */
202
+ requestBody?:
203
+ | IOperation.IRequestBody
204
+ | IJsonSchema.IReference<`#/components/requestBodies/${string}`>;
205
+
206
+ /** Response definitions by status code. */
207
+ responses?: Record<
208
+ string,
209
+ | IOperation.IResponse
210
+ | IJsonSchema.IReference<`#/components/responses/${string}`>
211
+ >;
212
+
213
+ /** Operation-level servers. */
214
+ servers?: IServer[];
215
+
216
+ /** Short summary. */
217
+ summary?: string;
218
+
219
+ /** Full description. */
220
+ description?: string;
221
+
222
+ /** Security requirements. */
223
+ security?: Record<string, string[]>[];
224
+
225
+ /** Operation tags. */
226
+ tags?: string[];
227
+
228
+ /** Whether deprecated. */
229
+ deprecated?: boolean;
230
+ }
231
+ export namespace IOperation {
232
+ /** Operation parameter. */
233
+ export interface IParameter {
234
+ /** Parameter name. */
235
+ name?: string;
236
+
237
+ /** Parameter location. */
238
+ in: "path" | "query" | "querystring" | "header" | "cookie";
239
+
240
+ /** Parameter schema. */
241
+ schema: IJsonSchema;
242
+
243
+ /** Whether required. */
244
+ required?: boolean;
245
+
246
+ /** Parameter description. */
247
+ description?: string;
248
+
249
+ /** Example value. */
250
+ example?: any;
251
+
252
+ /** Named examples. */
253
+ examples?: Record<
254
+ string,
255
+ IExample | IJsonSchema.IReference<`#/components/examples/${string}`>
256
+ >;
257
+ }
258
+
259
+ /** Request body. */
260
+ export interface IRequestBody {
261
+ /** Body description. */
262
+ description?: string;
263
+
264
+ /** Whether required. */
265
+ required?: boolean;
266
+
267
+ /** Body content by media type. */
268
+ content?: Record<string, IMediaType>;
269
+ }
270
+
271
+ /** Response definition. */
272
+ export interface IResponse {
273
+ /** Response content by media type. */
274
+ content?: Record<string, IMediaType>;
275
+
276
+ /** Response headers. */
277
+ headers?: Record<
278
+ string,
279
+ | Omit<IOperation.IParameter, "in">
280
+ | IJsonSchema.IReference<`#/components/headers/${string}`>
281
+ >;
282
+
283
+ /** Response description. */
284
+ description?: string;
285
+ }
286
+
287
+ /** Media type definition. */
288
+ export interface IMediaType {
289
+ /** Content schema. */
290
+ schema?: IJsonSchema;
291
+
292
+ /** Schema for streaming items (SSE, JSON Lines, etc.). */
293
+ itemSchema?: IJsonSchema;
294
+
295
+ /** Example value. */
296
+ example?: any;
297
+
298
+ /** Named examples. */
299
+ examples?: Record<
300
+ string,
301
+ IExample | IJsonSchema.IReference<`#/components/examples/${string}`>
302
+ >;
303
+ }
304
+ }
305
+
306
+ /** Example value definition. */
307
+ export interface IExample {
308
+ /** Example summary. */
309
+ summary?: string;
310
+
311
+ /** Example description. */
312
+ description?: string;
313
+
314
+ /** Example value. */
315
+ value?: any;
316
+
317
+ /** External value URL. */
318
+ externalValue?: string;
319
+ }
320
+
321
+ /* -----------------------------------------------------------
322
+ SCHEMA DEFINITIONS
323
+ ----------------------------------------------------------- */
324
+ /** Reusable components storage. */
325
+ export interface IComponents {
326
+ /** Named schemas. */
327
+ schemas?: Record<string, IJsonSchema>;
328
+
329
+ /** Named path items. */
330
+ pathItems?: Record<string, IPath>;
331
+
332
+ /** Named responses. */
333
+ responses?: Record<string, IOperation.IResponse>;
334
+
335
+ /** Named parameters. */
336
+ parameters?: Record<string, IOperation.IParameter>;
337
+
338
+ /** Named request bodies. */
339
+ requestBodies?: Record<string, IOperation.IRequestBody>;
340
+
341
+ /** Named security schemes. */
342
+ securitySchemes?: Record<string, ISecurityScheme>;
343
+
344
+ /** Named headers. */
345
+ headers?: Record<string, Omit<IOperation.IParameter, "in">>;
346
+
347
+ /** Named examples. */
348
+ examples?: Record<string, IExample>;
349
+ }
350
+
351
+ /** JSON Schema type for OpenAPI v3.1. */
352
+ export type IJsonSchema =
353
+ | IJsonSchema.IMixed
354
+ | IJsonSchema.IConstant
355
+ | IJsonSchema.IBoolean
356
+ | IJsonSchema.IInteger
357
+ | IJsonSchema.INumber
358
+ | IJsonSchema.IString
359
+ | IJsonSchema.IArray
360
+ | IJsonSchema.IObject
361
+ | IJsonSchema.IReference
362
+ | IJsonSchema.IRecursiveReference
363
+ | IJsonSchema.IAllOf
364
+ | IJsonSchema.IAnyOf
365
+ | IJsonSchema.IOneOf
366
+ | IJsonSchema.INull
367
+ | IJsonSchema.IUnknown;
368
+ export namespace IJsonSchema {
369
+ /** Mixed type (multiple types in array). */
370
+ export interface IMixed
371
+ extends
372
+ IConstant,
373
+ Omit<IBoolean, "type" | "default" | "enum">,
374
+ Omit<INumber, "type" | "default" | "enum">,
375
+ Omit<IString, "type" | "default" | "enum">,
376
+ Omit<IArray, "type">,
377
+ Omit<IObject, "type">,
378
+ IOneOf,
379
+ IAnyOf,
380
+ IAllOf,
381
+ IReference {
382
+ /** Array of type discriminators. */
383
+ type: Array<
384
+ | "boolean"
385
+ | "integer"
386
+ | "number"
387
+ | "string"
388
+ | "array"
389
+ | "object"
390
+ | "null"
391
+ >;
392
+
393
+ /** Default value. */
394
+ default?: any[] | null;
395
+
396
+ /** Allowed values. */
397
+ enum?: any[];
398
+ }
399
+
400
+ /** Constant value type. */
401
+ export interface IConstant extends __IAttribute {
402
+ /** Constant value. */
403
+ const: boolean | number | string;
404
+
405
+ /** Whether nullable. */
406
+ nullable?: boolean;
407
+ }
408
+
409
+ /** Boolean type. */
410
+ export interface IBoolean
411
+ extends Omit<IJsonSchemaAttribute.IBoolean, "examples">, __IAttribute {
412
+ /** Whether nullable. */
413
+ nullable?: boolean;
414
+
415
+ /** Default value. */
416
+ default?: boolean | null;
417
+
418
+ /** Allowed values. */
419
+ enum?: Array<boolean | null>;
420
+ }
421
+
422
+ /** Integer type. */
423
+ export interface IInteger
424
+ extends Omit<IJsonSchemaAttribute.IInteger, "examples">, __IAttribute {
425
+ /** Whether nullable. */
426
+ nullable?: boolean;
427
+
428
+ /** Default value. */
429
+ default?: (number & tags.Type<"int64">) | null;
430
+
431
+ /** Allowed values. */
432
+ enum?: Array<(number & tags.Type<"int64">) | null>;
433
+
434
+ /** Minimum value. */
435
+ minimum?: number & tags.Type<"int64">;
436
+
437
+ /** Maximum value. */
438
+ maximum?: number & tags.Type<"int64">;
439
+
440
+ /** Exclusive minimum. */
441
+ exclusiveMinimum?: (number & tags.Type<"int64">) | boolean;
442
+
443
+ /** Exclusive maximum. */
444
+ exclusiveMaximum?: (number & tags.Type<"int64">) | boolean;
445
+
446
+ /** Multiple of constraint. */
447
+ multipleOf?: number & tags.ExclusiveMinimum<0>;
448
+ }
449
+
450
+ /** Number (double) type. */
451
+ export interface INumber
452
+ extends Omit<IJsonSchemaAttribute.INumber, "examples">, __IAttribute {
453
+ /** Whether nullable. */
454
+ nullable?: boolean;
455
+
456
+ /** Default value. */
457
+ default?: number | null;
458
+
459
+ /** Allowed values. */
460
+ enum?: Array<number | null>;
461
+
462
+ /** Minimum value. */
463
+ minimum?: number;
464
+
465
+ /** Maximum value. */
466
+ maximum?: number;
467
+
468
+ /** Exclusive minimum. */
469
+ exclusiveMinimum?: number | boolean;
470
+
471
+ /** Exclusive maximum. */
472
+ exclusiveMaximum?: number | boolean;
473
+
474
+ /** Multiple of constraint. */
475
+ multipleOf?: number & tags.ExclusiveMinimum<0>;
476
+ }
477
+
478
+ /** String type. */
479
+ export interface IString
480
+ extends Omit<IJsonSchemaAttribute.IString, "examples">, __IAttribute {
481
+ /** Whether nullable. */
482
+ nullable?: boolean;
483
+
484
+ /** Default value. */
485
+ default?: string | null;
486
+
487
+ /** Allowed values. */
488
+ enum?: Array<string | null>;
489
+
490
+ /** String format. */
491
+ format?:
492
+ | "binary"
493
+ | "byte"
494
+ | "password"
495
+ | "regex"
496
+ | "uuid"
497
+ | "email"
498
+ | "hostname"
499
+ | "idn-email"
500
+ | "idn-hostname"
501
+ | "iri"
502
+ | "iri-reference"
503
+ | "ipv4"
504
+ | "ipv6"
505
+ | "uri"
506
+ | "uri-reference"
507
+ | "uri-template"
508
+ | "url"
509
+ | "date-time"
510
+ | "date"
511
+ | "time"
512
+ | "duration"
513
+ | "json-pointer"
514
+ | "relative-json-pointer"
515
+ | (string & {});
516
+
517
+ /** Regex pattern. */
518
+ pattern?: string;
519
+
520
+ /** Content media type. */
521
+ contentMediaType?: string;
522
+
523
+ /** Minimum length. */
524
+ minLength?: number & tags.Type<"uint64">;
525
+
526
+ /** Maximum length. */
527
+ maxLength?: number & tags.Type<"uint64">;
528
+ }
529
+
530
+ /** Object type. */
531
+ export interface IObject
532
+ extends Omit<IJsonSchemaAttribute.IObject, "examples">, __IAttribute {
533
+ /** Whether nullable. */
534
+ nullable?: boolean;
535
+
536
+ /** Property schemas. */
537
+ properties?: Record<string, IJsonSchema>;
538
+
539
+ /** Required property names. */
540
+ required?: string[];
541
+
542
+ /** Additional properties schema. */
543
+ additionalProperties?: boolean | IJsonSchema;
544
+
545
+ /** Maximum properties. */
546
+ maxProperties?: number;
547
+
548
+ /** Minimum properties. */
549
+ minProperties?: number;
550
+ }
551
+
552
+ /** Array type. */
553
+ export interface IArray
554
+ extends Omit<IJsonSchemaAttribute.IArray, "examples">, __IAttribute {
555
+ /** Whether nullable. */
556
+ nullable?: boolean;
557
+
558
+ /** Element type (or tuple types). */
559
+ items?: IJsonSchema | IJsonSchema[];
560
+
561
+ /** Tuple prefix items. */
562
+ prefixItems?: IJsonSchema[];
563
+
564
+ /** Whether elements must be unique. */
565
+ uniqueItems?: boolean;
566
+
567
+ /** Additional items schema. */
568
+ additionalItems?: boolean | IJsonSchema;
569
+
570
+ /** Minimum items. */
571
+ minItems?: number & tags.Type<"uint64">;
572
+
573
+ /** Maximum items. */
574
+ maxItems?: number & tags.Type<"uint64">;
575
+ }
576
+
577
+ /** Reference to a named schema. */
578
+ export interface IReference<Key = string> extends __IAttribute {
579
+ /** Reference path. */
580
+ $ref: Key;
581
+ }
582
+
583
+ /** Recursive reference. */
584
+ export interface IRecursiveReference extends __IAttribute {
585
+ /** Recursive reference path. */
586
+ $recursiveRef: string;
587
+ }
588
+
589
+ /** All-of combination. */
590
+ export interface IAllOf extends __IAttribute {
591
+ /** Schemas to combine. */
592
+ allOf: IJsonSchema[];
593
+ }
594
+
595
+ /** Any-of union. */
596
+ export interface IAnyOf extends __IAttribute {
597
+ /** Union member schemas. */
598
+ anyOf: IJsonSchema[];
599
+ }
600
+
601
+ /** One-of union. */
602
+ export interface IOneOf extends __IAttribute {
603
+ /** Union member schemas. */
604
+ oneOf: IJsonSchema[];
605
+
606
+ /** Discriminator for tagged unions. */
607
+ discriminator?: IOneOf.IDiscriminator;
608
+ }
609
+ export namespace IOneOf {
610
+ /** Discriminator for tagged unions. */
611
+ export interface IDiscriminator {
612
+ /** Discriminator property name. */
613
+ propertyName: string;
614
+
615
+ /** Value to schema mapping. */
616
+ mapping?: Record<string, string>;
617
+ }
618
+ }
619
+
620
+ /** Null type. */
621
+ export interface INull
622
+ extends Omit<IJsonSchemaAttribute.INull, "examples">, __IAttribute {
623
+ /** Default value. */
624
+ default?: null;
625
+ }
626
+
627
+ /** Unknown type. */
628
+ export interface IUnknown
629
+ extends Omit<IJsonSchemaAttribute.IUnknown, "examples">, __IAttribute {
630
+ /** Type discriminator (undefined for unknown). */
631
+ type?: undefined;
632
+
633
+ /** Default value. */
634
+ default?: any;
635
+ }
636
+
637
+ /** @internal Base attribute interface. */
638
+ export interface __IAttribute extends Omit<
639
+ IJsonSchemaAttribute,
640
+ "examples"
641
+ > {
642
+ /** Example values. */
643
+ examples?: any[] | Record<string, any>;
644
+ }
645
+ }
646
+
647
+ /** Security scheme types. */
648
+ export type ISecurityScheme =
649
+ | ISecurityScheme.IApiKey
650
+ | ISecurityScheme.IHttpBasic
651
+ | ISecurityScheme.IHttpBearer
652
+ | ISecurityScheme.IOAuth2
653
+ | ISecurityScheme.IOpenId;
654
+ export namespace ISecurityScheme {
655
+ /** API key authentication. */
656
+ export interface IApiKey {
657
+ /** Scheme type. */
658
+ type: "apiKey";
659
+
660
+ /** Key location. */
661
+ in?: "header" | "query" | "cookie";
662
+
663
+ /** Key name. */
664
+ name?: string;
665
+
666
+ /** Scheme description. */
667
+ description?: string;
668
+ }
669
+
670
+ /** HTTP basic authentication. */
671
+ export interface IHttpBasic {
672
+ /** Scheme type. */
673
+ type: "http";
674
+
675
+ /** Authentication scheme. */
676
+ scheme: "basic";
677
+
678
+ /** Scheme description. */
679
+ description?: string;
680
+ }
681
+
682
+ /** HTTP bearer authentication. */
683
+ export interface IHttpBearer {
684
+ /** Scheme type. */
685
+ type: "http";
686
+
687
+ /** Authentication scheme. */
688
+ scheme: "bearer";
689
+
690
+ /** Bearer token format hint. */
691
+ bearerFormat?: string;
692
+
693
+ /** Scheme description. */
694
+ description?: string;
695
+ }
696
+
697
+ /** OAuth2 authentication. */
698
+ export interface IOAuth2 {
699
+ /** Scheme type. */
700
+ type: "oauth2";
701
+
702
+ /** OAuth2 flows. */
703
+ flows: IOAuth2.IFlowSet;
704
+
705
+ /** OAuth2 metadata discovery URL. */
706
+ oauth2MetadataUrl?: string;
707
+
708
+ /** Scheme description. */
709
+ description?: string;
710
+ }
711
+
712
+ /** OpenID Connect authentication. */
713
+ export interface IOpenId {
714
+ /** Scheme type. */
715
+ type: "openIdConnect";
716
+
717
+ /** OpenID Connect discovery URL. */
718
+ openIdConnectUrl: string;
719
+
720
+ /** Scheme description. */
721
+ description?: string;
722
+ }
723
+ export namespace IOAuth2 {
724
+ /** OAuth2 flow configurations. */
725
+ export interface IFlowSet {
726
+ /** Authorization code flow. */
727
+ authorizationCode?: IFlow;
728
+
729
+ /** Implicit flow. */
730
+ implicit?: Omit<IFlow, "tokenUrl">;
731
+
732
+ /** Password flow. */
733
+ password?: Omit<IFlow, "authorizationUrl">;
734
+
735
+ /** Client credentials flow. */
736
+ clientCredentials?: Omit<IFlow, "authorizationUrl">;
737
+
738
+ /** Device authorization flow. */
739
+ deviceAuthorization?: IDeviceFlow;
740
+ }
741
+
742
+ /** OAuth2 flow configuration. */
743
+ export interface IFlow {
744
+ /** Authorization URL. */
745
+ authorizationUrl?: string;
746
+
747
+ /** Token URL. */
748
+ tokenUrl?: string;
749
+
750
+ /** Refresh URL. */
751
+ refreshUrl?: string;
752
+
753
+ /** Available scopes. */
754
+ scopes?: Record<string, string>;
755
+ }
756
+
757
+ /** OAuth2 device authorization flow. */
758
+ export interface IDeviceFlow {
759
+ /** Device authorization URL. */
760
+ deviceAuthorizationUrl: string;
761
+
762
+ /** Token URL. */
763
+ tokenUrl: string;
764
+
765
+ /** Refresh URL. */
766
+ refreshUrl?: string;
767
+
768
+ /** Available scopes. */
769
+ scopes?: Record<string, string>;
770
+ }
771
+ }
772
+ }
773
+ }