@typia/interface 12.0.0-dev.20260311 → 12.0.0-dev.20260312

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