@typia/interface 12.0.0-dev.20260309 → 12.0.0-dev.20260310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/lib/http/IHttpLlmController.d.ts +5 -5
  2. package/lib/schema/IJsonParseResult.d.ts +1 -3
  3. package/lib/schema/ILlmController.d.ts +2 -5
  4. package/package.json +1 -1
  5. package/src/http/IHttpConnection.ts +200 -200
  6. package/src/http/IHttpLlmApplication.ts +72 -72
  7. package/src/http/IHttpLlmController.ts +96 -96
  8. package/src/http/IHttpLlmFunction.ts +34 -34
  9. package/src/http/IHttpMigrateApplication.ts +48 -48
  10. package/src/http/IHttpMigrateRoute.ts +165 -165
  11. package/src/http/IHttpResponse.ts +42 -42
  12. package/src/http/index.ts +7 -7
  13. package/src/index.ts +9 -9
  14. package/src/metadata/IJsDocTagInfo.ts +25 -25
  15. package/src/metadata/IMetadataComponents.ts +24 -24
  16. package/src/metadata/IMetadataSchema.ts +293 -293
  17. package/src/metadata/IMetadataSchemaCollection.ts +20 -20
  18. package/src/metadata/IMetadataSchemaUnit.ts +20 -20
  19. package/src/metadata/IMetadataTypeTag.ts +39 -39
  20. package/src/metadata/index.ts +6 -6
  21. package/src/openapi/OpenApi.ts +643 -643
  22. package/src/openapi/OpenApiV3.ts +655 -655
  23. package/src/openapi/OpenApiV3_1.ts +735 -735
  24. package/src/openapi/SwaggerV2.ts +559 -559
  25. package/src/openapi/index.ts +4 -4
  26. package/src/protobuf/ProtobufWire.ts +51 -51
  27. package/src/protobuf/index.ts +1 -1
  28. package/src/schema/IJsonParseResult.ts +134 -136
  29. package/src/schema/IJsonSchemaApplication.ts +274 -274
  30. package/src/schema/IJsonSchemaAttribute.ts +158 -158
  31. package/src/schema/IJsonSchemaCollection.ts +123 -123
  32. package/src/schema/IJsonSchemaTransformError.ts +86 -86
  33. package/src/schema/IJsonSchemaUnit.ts +120 -120
  34. package/src/schema/ILlmApplication.ts +99 -99
  35. package/src/schema/ILlmController.ts +54 -57
  36. package/src/schema/ILlmFunction.ts +145 -145
  37. package/src/schema/ILlmSchema.ts +484 -484
  38. package/src/schema/IResult.ts +84 -84
  39. package/src/schema/IValidation.ts +134 -134
  40. package/src/schema/index.ts +14 -14
  41. package/src/tags/Constant.ts +49 -49
  42. package/src/tags/ContentMediaType.ts +40 -40
  43. package/src/tags/Default.ts +50 -50
  44. package/src/tags/Example.ts +48 -48
  45. package/src/tags/Examples.ts +50 -50
  46. package/src/tags/ExclusiveMaximum.ts +46 -46
  47. package/src/tags/ExclusiveMinimum.ts +46 -46
  48. package/src/tags/Format.ts +76 -76
  49. package/src/tags/JsonSchemaPlugin.ts +45 -45
  50. package/src/tags/MaxItems.ts +39 -39
  51. package/src/tags/MaxLength.ts +37 -37
  52. package/src/tags/Maximum.ts +44 -44
  53. package/src/tags/MinItems.ts +39 -39
  54. package/src/tags/MinLength.ts +37 -37
  55. package/src/tags/Minimum.ts +44 -44
  56. package/src/tags/MultipleOf.ts +54 -54
  57. package/src/tags/Pattern.ts +59 -59
  58. package/src/tags/Sequence.ts +43 -43
  59. package/src/tags/TagBase.ts +131 -131
  60. package/src/tags/Type.ts +70 -70
  61. package/src/tags/UniqueItems.ts +44 -44
  62. package/src/tags/index.ts +21 -21
  63. package/src/typings/AssertionGuard.ts +12 -12
  64. package/src/typings/Atomic.ts +21 -21
  65. package/src/typings/CamelCase.ts +75 -75
  66. package/src/typings/ClassProperties.ts +15 -15
  67. package/src/typings/DeepPartial.ts +39 -39
  68. package/src/typings/OmitNever.ts +12 -12
  69. package/src/typings/PascalCase.ts +71 -71
  70. package/src/typings/Primitive.ts +71 -71
  71. package/src/typings/ProtobufAtomic.ts +30 -30
  72. package/src/typings/Resolved.ts +58 -58
  73. package/src/typings/SnakeCase.ts +126 -126
  74. package/src/typings/SpecialFields.ts +13 -13
  75. package/src/typings/ValidationPipe.ts +20 -20
  76. package/src/typings/index.ts +14 -14
  77. package/src/typings/internal/Equal.ts +14 -14
  78. package/src/typings/internal/IsTuple.ts +17 -17
  79. package/src/typings/internal/NativeClass.ts +31 -31
  80. package/src/typings/internal/ValueOf.ts +29 -29
  81. package/src/utils/IRandomGenerator.ts +105 -105
  82. package/src/utils/IReadableURLSearchParams.ts +25 -25
  83. package/src/utils/index.ts +2 -2
@@ -1,559 +1,559 @@
1
- import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
2
- import * as tags from "../tags";
3
-
4
- /**
5
- * Swagger v2.0 specification types.
6
- *
7
- * `SwaggerV2` contains TypeScript type definitions for Swagger v2.0 (OpenAPI
8
- * v2) documents. Used for parsing legacy Swagger specifications. For a
9
- * normalized format that unifies all OpenAPI versions, use {@link OpenApi}.
10
- *
11
- * Key differences from OpenAPI v3.x:
12
- *
13
- * - Uses `definitions` instead of `components.schemas`
14
- * - Body parameters use `in: "body"` with `schema` property
15
- * - No `requestBody`, `oneOf`, `anyOf`, or `nullable`
16
- * - Uses `host` + `basePath` instead of `servers`
17
- *
18
- * @author Jeongho Nam - https://github.com/samchon
19
- */
20
- export namespace SwaggerV2 {
21
- /** HTTP method of the operation. */
22
- export type Method =
23
- | "get"
24
- | "post"
25
- | "put"
26
- | "delete"
27
- | "options"
28
- | "head"
29
- | "patch"
30
- | "trace";
31
-
32
- /* -----------------------------------------------------------
33
- DOCUMENTS
34
- ----------------------------------------------------------- */
35
- /** Swagger document structure. */
36
- export interface IDocument {
37
- /** Swagger version. */
38
- swagger: "2.0" | `2.0.${number}`;
39
-
40
- /** API metadata. */
41
- info?: IDocument.IInfo;
42
-
43
- /** Host address. */
44
- host?: string;
45
-
46
- /** Base path for all operations. */
47
- basePath?: string;
48
-
49
- /** Global content types consumed. */
50
- consumes?: string[];
51
-
52
- /** Global content types produced. */
53
- produces?: string[];
54
-
55
- /** Schema definitions. */
56
- definitions?: Record<string, IJsonSchema>;
57
-
58
- /** Reusable parameter definitions. */
59
- parameters?: Record<string, IOperation.IParameter>;
60
-
61
- /** Reusable response definitions. */
62
- responses?: Record<string, IOperation.IResponse>;
63
-
64
- /** Security scheme definitions. */
65
- securityDefinitions?: Record<string, ISecurityDefinition>;
66
-
67
- /** Global security requirements. */
68
- security?: Record<string, string[]>[];
69
-
70
- /** API paths and operations. */
71
- paths?: Record<string, IPath>;
72
-
73
- /** Tag definitions. */
74
- tags?: IDocument.ITag[];
75
- }
76
- export namespace IDocument {
77
- /** API metadata. */
78
- export interface IInfo {
79
- /** API title. */
80
- title: string;
81
-
82
- /** API description. */
83
- description?: string;
84
-
85
- /** Terms of service URL. */
86
- termsOfService?: string;
87
-
88
- /** Contact information. */
89
- contact?: IContact;
90
-
91
- /** License information. */
92
- license?: ILicense;
93
-
94
- /** API version. */
95
- version: string;
96
- }
97
-
98
- /** Contact information. */
99
- export interface IContact {
100
- /** Contact name. */
101
- name?: string;
102
-
103
- /** Contact URL. */
104
- url?: string;
105
-
106
- /** Contact email. */
107
- email?: string & tags.Format<"email">;
108
- }
109
-
110
- /** License information. */
111
- export interface ILicense {
112
- /** License name. */
113
- name: string;
114
-
115
- /** License URL. */
116
- url?: string;
117
- }
118
-
119
- /** Tag for grouping operations. */
120
- export interface ITag {
121
- /** Tag name. */
122
- name: string;
123
-
124
- /** Tag description. */
125
- description?: string;
126
- }
127
- }
128
-
129
- /* -----------------------------------------------------------
130
- OPERATORS
131
- ----------------------------------------------------------- */
132
- /** Path item containing operations by HTTP method. */
133
- export interface IPath extends Partial<
134
- Record<Method, IOperation | undefined>
135
- > {
136
- /** Path-level parameters. */
137
- parameters?: Array<
138
- IOperation.IParameter | IJsonSchema.IReference<`#/parameters/${string}`>
139
- >;
140
- }
141
-
142
- /** API operation metadata. */
143
- export interface IOperation {
144
- /** Unique operation identifier. */
145
- operationId?: string;
146
-
147
- /** Operation parameters. */
148
- parameters?: Array<
149
- | IOperation.IParameter
150
- | IJsonSchema.IReference<`#/definitions/parameters/${string}`>
151
- >;
152
-
153
- /** Response definitions by status code. */
154
- responses?: Record<
155
- string,
156
- | IOperation.IResponse
157
- | IJsonSchema.IReference<`#/definitions/responses/${string}`>
158
- >;
159
-
160
- /** Short summary. */
161
- summary?: string;
162
-
163
- /** Full description. */
164
- description?: string;
165
-
166
- /** Security requirements. */
167
- security?: Record<string, string[]>[];
168
-
169
- /** Operation tags. */
170
- tags?: string[];
171
-
172
- /** Whether deprecated. */
173
- deprecated?: boolean;
174
- }
175
- export namespace IOperation {
176
- /** Operation parameter (general or body). */
177
- export type IParameter = IGeneralParameter | IBodyParameter;
178
-
179
- /** General parameter (path, query, header, formData). */
180
- export type IGeneralParameter = IJsonSchema & {
181
- name: string;
182
- in: string;
183
- description?: string;
184
- };
185
-
186
- /** Body parameter. */
187
- export interface IBodyParameter {
188
- /** Body schema. */
189
- schema: IJsonSchema;
190
-
191
- /** Parameter name. */
192
- name: string;
193
-
194
- /** Parameter location (always "body"). */
195
- in: string;
196
-
197
- /** Parameter description. */
198
- description?: string;
199
-
200
- /** Whether required. */
201
- required?: boolean;
202
- }
203
-
204
- /** Response definition. */
205
- export interface IResponse {
206
- /** Response description. */
207
- description?: string;
208
-
209
- /** Response headers. */
210
- headers?: Record<string, IJsonSchema>;
211
-
212
- /** Response body schema. */
213
- schema?: IJsonSchema;
214
-
215
- /** Example value. */
216
- example?: any;
217
- }
218
- }
219
-
220
- /* -----------------------------------------------------------
221
- DEFINITIONS
222
- ----------------------------------------------------------- */
223
- /** JSON Schema type for Swagger. */
224
- export type IJsonSchema =
225
- | IJsonSchema.IBoolean
226
- | IJsonSchema.IInteger
227
- | IJsonSchema.INumber
228
- | IJsonSchema.IString
229
- | IJsonSchema.IArray
230
- | IJsonSchema.IObject
231
- | IJsonSchema.IReference
232
- | IJsonSchema.IAnyOf
233
- | IJsonSchema.IOneOf
234
- | IJsonSchema.INullOnly
235
- | IJsonSchema.IUnknown;
236
- export namespace IJsonSchema {
237
- /** Boolean type. */
238
- export interface IBoolean
239
- extends
240
- Omit<IJsonSchemaAttribute.IBoolean, "examples">,
241
- __ISignificant<"boolean"> {
242
- /** Default value. */
243
- default?: boolean | null;
244
-
245
- /** Allowed values. */
246
- enum?: Array<boolean | null>;
247
- }
248
-
249
- /** Integer type. */
250
- export interface IInteger
251
- extends
252
- Omit<IJsonSchemaAttribute.IInteger, "examples">,
253
- __ISignificant<"integer"> {
254
- /** Default value. */
255
- default?: (number & tags.Type<"int64">) | null;
256
-
257
- /** Allowed values. */
258
- enum?: Array<(number & tags.Type<"int64">) | null>;
259
-
260
- /** Minimum value. */
261
- minimum?: number & tags.Type<"int64">;
262
-
263
- /** Maximum value. */
264
- maximum?: number & tags.Type<"int64">;
265
-
266
- /** Exclusive minimum. */
267
- exclusiveMinimum?: number | boolean;
268
-
269
- /** Exclusive maximum. */
270
- exclusiveMaximum?: number | boolean;
271
-
272
- /** Multiple of constraint. */
273
- multipleOf?: number & tags.ExclusiveMinimum<0>;
274
- }
275
-
276
- /** Number (double) type. */
277
- export interface INumber
278
- extends
279
- Omit<IJsonSchemaAttribute.INumber, "examples">,
280
- __ISignificant<"number"> {
281
- /** Default value. */
282
- default?: number | null;
283
-
284
- /** Allowed values. */
285
- enum?: Array<number | null>;
286
-
287
- /** Minimum value. */
288
- minimum?: number;
289
-
290
- /** Maximum value. */
291
- maximum?: number;
292
-
293
- /** Exclusive minimum. */
294
- exclusiveMinimum?: number | boolean;
295
-
296
- /** Exclusive maximum. */
297
- exclusiveMaximum?: number | boolean;
298
-
299
- /** Multiple of constraint. */
300
- multipleOf?: number & tags.ExclusiveMinimum<0>;
301
- }
302
-
303
- /** String type. */
304
- export interface IString
305
- extends
306
- Omit<IJsonSchemaAttribute.IString, "examples">,
307
- __ISignificant<"string"> {
308
- /** Default value. */
309
- default?: string | null;
310
-
311
- /** Allowed values. */
312
- enum?: Array<string | null>;
313
-
314
- /** String format. */
315
- format?:
316
- | "binary"
317
- | "byte"
318
- | "password"
319
- | "regex"
320
- | "uuid"
321
- | "email"
322
- | "hostname"
323
- | "idn-email"
324
- | "idn-hostname"
325
- | "iri"
326
- | "iri-reference"
327
- | "ipv4"
328
- | "ipv6"
329
- | "uri"
330
- | "uri-reference"
331
- | "uri-template"
332
- | "url"
333
- | "date-time"
334
- | "date"
335
- | "time"
336
- | "duration"
337
- | "json-pointer"
338
- | "relative-json-pointer"
339
- | (string & {});
340
-
341
- /** Regex pattern. */
342
- pattern?: string;
343
-
344
- /** Minimum length. */
345
- minLength?: number & tags.Type<"uint64">;
346
-
347
- /** Maximum length. */
348
- maxLength?: number & tags.Type<"uint64">;
349
- }
350
-
351
- /** Array type. */
352
- export interface IArray
353
- extends
354
- Omit<IJsonSchemaAttribute.IArray, "examples">,
355
- __ISignificant<"array"> {
356
- /** Element type. */
357
- items: IJsonSchema;
358
-
359
- /** Whether elements must be unique. */
360
- uniqueItems?: boolean;
361
-
362
- /** Minimum items. */
363
- minItems?: number & tags.Type<"uint64">;
364
-
365
- /** Maximum items. */
366
- maxItems?: number & tags.Type<"uint64">;
367
- }
368
-
369
- /** Object type. */
370
- export interface IObject
371
- extends
372
- Omit<IJsonSchemaAttribute.IObject, "examples">,
373
- __ISignificant<"object"> {
374
- /** Property schemas. */
375
- properties?: Record<string, IJsonSchema>;
376
-
377
- /** Required property names. */
378
- required?: string[];
379
-
380
- /** Additional properties schema. */
381
- additionalProperties?: boolean | IJsonSchema;
382
-
383
- /** Maximum properties. */
384
- maxProperties?: number;
385
-
386
- /** Minimum properties. */
387
- minProperties?: number;
388
- }
389
-
390
- /** Reference to a named schema. */
391
- export interface IReference<Key = string> extends __IAttribute {
392
- /** Reference path. */
393
- $ref: Key;
394
- }
395
-
396
- /** All-of combination. */
397
- export interface IAllOf extends __IAttribute {
398
- /** Schemas to combine. */
399
- allOf: IJsonSchema[];
400
- }
401
-
402
- /** Any-of union (Swagger extension). */
403
- export interface IAnyOf extends __IAttribute {
404
- /** Union member schemas. */
405
- "x-anyOf": IJsonSchema[];
406
- }
407
-
408
- /** One-of union (Swagger extension). */
409
- export interface IOneOf extends __IAttribute {
410
- /** Union member schemas. */
411
- "x-oneOf": IJsonSchema[];
412
- }
413
-
414
- /** Null type. */
415
- export interface INullOnly extends __IAttribute {
416
- /** Type discriminator. */
417
- type: "null";
418
-
419
- /** Default value. */
420
- default?: null;
421
- }
422
-
423
- /** Unknown type. */
424
- export interface IUnknown extends __IAttribute {
425
- /** Type discriminator (undefined for unknown). */
426
- type?: undefined;
427
- }
428
-
429
- /** @internal Base interface with type discriminator. */
430
- export interface __ISignificant<Type extends string> extends __IAttribute {
431
- /** Type discriminator. */
432
- type: Type;
433
-
434
- /** Nullable flag (Swagger extension). */
435
- "x-nullable"?: boolean;
436
- }
437
-
438
- /** @internal Base attribute interface. */
439
- export interface __IAttribute extends Omit<
440
- IJsonSchemaAttribute,
441
- "examples" | "writeOnly"
442
- > {
443
- /** Example values. */
444
- examples?: any[];
445
- }
446
- }
447
-
448
- /** Security scheme types. */
449
- export type ISecurityDefinition =
450
- | ISecurityDefinition.IApiKey
451
- | ISecurityDefinition.IBasic
452
- | ISecurityDefinition.IOauth2Implicit
453
- | ISecurityDefinition.IOauth2AccessCode
454
- | ISecurityDefinition.IOauth2Password
455
- | ISecurityDefinition.IOauth2Application;
456
- export namespace ISecurityDefinition {
457
- /** API key authentication. */
458
- export interface IApiKey {
459
- /** Scheme type. */
460
- type: "apiKey";
461
-
462
- /** Key location. */
463
- in?: "header" | "query" | "cookie";
464
-
465
- /** Key name. */
466
- name?: string;
467
-
468
- /** Scheme description. */
469
- description?: string;
470
- }
471
-
472
- /** HTTP basic authentication. */
473
- export interface IBasic {
474
- /** Scheme type. */
475
- type: "basic";
476
-
477
- /** Scheme name. */
478
- name?: string;
479
-
480
- /** Scheme description. */
481
- description?: string;
482
- }
483
-
484
- /** OAuth2 implicit flow. */
485
- export interface IOauth2Implicit {
486
- /** Scheme type. */
487
- type: "oauth2";
488
-
489
- /** OAuth2 flow type. */
490
- flow: "implicit";
491
-
492
- /** Authorization URL. */
493
- authorizationUrl?: string;
494
-
495
- /** Available scopes. */
496
- scopes?: Record<string, string>;
497
-
498
- /** Scheme description. */
499
- description?: string;
500
- }
501
-
502
- /** OAuth2 authorization code flow. */
503
- export interface IOauth2AccessCode {
504
- /** Scheme type. */
505
- type: "oauth2";
506
-
507
- /** OAuth2 flow type. */
508
- flow: "accessCode";
509
-
510
- /** Authorization URL. */
511
- authorizationUrl?: string;
512
-
513
- /** Token URL. */
514
- tokenUrl?: string;
515
-
516
- /** Available scopes. */
517
- scopes?: Record<string, string>;
518
-
519
- /** Scheme description. */
520
- description?: string;
521
- }
522
-
523
- /** OAuth2 password flow. */
524
- export interface IOauth2Password {
525
- /** Scheme type. */
526
- type: "oauth2";
527
-
528
- /** OAuth2 flow type. */
529
- flow: "password";
530
-
531
- /** Token URL. */
532
- tokenUrl?: string;
533
-
534
- /** Available scopes. */
535
- scopes?: Record<string, string>;
536
-
537
- /** Scheme description. */
538
- description?: string;
539
- }
540
-
541
- /** OAuth2 application (client credentials) flow. */
542
- export interface IOauth2Application {
543
- /** Scheme type. */
544
- type: "oauth2";
545
-
546
- /** OAuth2 flow type. */
547
- flow: "application";
548
-
549
- /** Token URL. */
550
- tokenUrl?: string;
551
-
552
- /** Available scopes. */
553
- scopes?: Record<string, string>;
554
-
555
- /** Scheme description. */
556
- description?: string;
557
- }
558
- }
559
- }
1
+ import { IJsonSchemaAttribute } from "../schema/IJsonSchemaAttribute";
2
+ import * as tags from "../tags";
3
+
4
+ /**
5
+ * Swagger v2.0 specification types.
6
+ *
7
+ * `SwaggerV2` contains TypeScript type definitions for Swagger v2.0 (OpenAPI
8
+ * v2) documents. Used for parsing legacy Swagger specifications. For a
9
+ * normalized format that unifies all OpenAPI versions, use {@link OpenApi}.
10
+ *
11
+ * Key differences from OpenAPI v3.x:
12
+ *
13
+ * - Uses `definitions` instead of `components.schemas`
14
+ * - Body parameters use `in: "body"` with `schema` property
15
+ * - No `requestBody`, `oneOf`, `anyOf`, or `nullable`
16
+ * - Uses `host` + `basePath` instead of `servers`
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ */
20
+ export namespace SwaggerV2 {
21
+ /** HTTP method of the operation. */
22
+ export type Method =
23
+ | "get"
24
+ | "post"
25
+ | "put"
26
+ | "delete"
27
+ | "options"
28
+ | "head"
29
+ | "patch"
30
+ | "trace";
31
+
32
+ /* -----------------------------------------------------------
33
+ DOCUMENTS
34
+ ----------------------------------------------------------- */
35
+ /** Swagger document structure. */
36
+ export interface IDocument {
37
+ /** Swagger version. */
38
+ swagger: "2.0" | `2.0.${number}`;
39
+
40
+ /** API metadata. */
41
+ info?: IDocument.IInfo;
42
+
43
+ /** Host address. */
44
+ host?: string;
45
+
46
+ /** Base path for all operations. */
47
+ basePath?: string;
48
+
49
+ /** Global content types consumed. */
50
+ consumes?: string[];
51
+
52
+ /** Global content types produced. */
53
+ produces?: string[];
54
+
55
+ /** Schema definitions. */
56
+ definitions?: Record<string, IJsonSchema>;
57
+
58
+ /** Reusable parameter definitions. */
59
+ parameters?: Record<string, IOperation.IParameter>;
60
+
61
+ /** Reusable response definitions. */
62
+ responses?: Record<string, IOperation.IResponse>;
63
+
64
+ /** Security scheme definitions. */
65
+ securityDefinitions?: Record<string, ISecurityDefinition>;
66
+
67
+ /** Global security requirements. */
68
+ security?: Record<string, string[]>[];
69
+
70
+ /** API paths and operations. */
71
+ paths?: Record<string, IPath>;
72
+
73
+ /** Tag definitions. */
74
+ tags?: IDocument.ITag[];
75
+ }
76
+ export namespace IDocument {
77
+ /** API metadata. */
78
+ export interface IInfo {
79
+ /** API title. */
80
+ title: string;
81
+
82
+ /** API description. */
83
+ description?: string;
84
+
85
+ /** Terms of service URL. */
86
+ termsOfService?: string;
87
+
88
+ /** Contact information. */
89
+ contact?: IContact;
90
+
91
+ /** License information. */
92
+ license?: ILicense;
93
+
94
+ /** API version. */
95
+ version: string;
96
+ }
97
+
98
+ /** Contact information. */
99
+ export interface IContact {
100
+ /** Contact name. */
101
+ name?: string;
102
+
103
+ /** Contact URL. */
104
+ url?: string;
105
+
106
+ /** Contact email. */
107
+ email?: string & tags.Format<"email">;
108
+ }
109
+
110
+ /** License information. */
111
+ export interface ILicense {
112
+ /** License name. */
113
+ name: string;
114
+
115
+ /** License URL. */
116
+ url?: string;
117
+ }
118
+
119
+ /** Tag for grouping operations. */
120
+ export interface ITag {
121
+ /** Tag name. */
122
+ name: string;
123
+
124
+ /** Tag description. */
125
+ description?: string;
126
+ }
127
+ }
128
+
129
+ /* -----------------------------------------------------------
130
+ OPERATORS
131
+ ----------------------------------------------------------- */
132
+ /** Path item containing operations by HTTP method. */
133
+ export interface IPath extends Partial<
134
+ Record<Method, IOperation | undefined>
135
+ > {
136
+ /** Path-level parameters. */
137
+ parameters?: Array<
138
+ IOperation.IParameter | IJsonSchema.IReference<`#/parameters/${string}`>
139
+ >;
140
+ }
141
+
142
+ /** API operation metadata. */
143
+ export interface IOperation {
144
+ /** Unique operation identifier. */
145
+ operationId?: string;
146
+
147
+ /** Operation parameters. */
148
+ parameters?: Array<
149
+ | IOperation.IParameter
150
+ | IJsonSchema.IReference<`#/definitions/parameters/${string}`>
151
+ >;
152
+
153
+ /** Response definitions by status code. */
154
+ responses?: Record<
155
+ string,
156
+ | IOperation.IResponse
157
+ | IJsonSchema.IReference<`#/definitions/responses/${string}`>
158
+ >;
159
+
160
+ /** Short summary. */
161
+ summary?: string;
162
+
163
+ /** Full description. */
164
+ description?: string;
165
+
166
+ /** Security requirements. */
167
+ security?: Record<string, string[]>[];
168
+
169
+ /** Operation tags. */
170
+ tags?: string[];
171
+
172
+ /** Whether deprecated. */
173
+ deprecated?: boolean;
174
+ }
175
+ export namespace IOperation {
176
+ /** Operation parameter (general or body). */
177
+ export type IParameter = IGeneralParameter | IBodyParameter;
178
+
179
+ /** General parameter (path, query, header, formData). */
180
+ export type IGeneralParameter = IJsonSchema & {
181
+ name: string;
182
+ in: string;
183
+ description?: string;
184
+ };
185
+
186
+ /** Body parameter. */
187
+ export interface IBodyParameter {
188
+ /** Body schema. */
189
+ schema: IJsonSchema;
190
+
191
+ /** Parameter name. */
192
+ name: string;
193
+
194
+ /** Parameter location (always "body"). */
195
+ in: string;
196
+
197
+ /** Parameter description. */
198
+ description?: string;
199
+
200
+ /** Whether required. */
201
+ required?: boolean;
202
+ }
203
+
204
+ /** Response definition. */
205
+ export interface IResponse {
206
+ /** Response description. */
207
+ description?: string;
208
+
209
+ /** Response headers. */
210
+ headers?: Record<string, IJsonSchema>;
211
+
212
+ /** Response body schema. */
213
+ schema?: IJsonSchema;
214
+
215
+ /** Example value. */
216
+ example?: any;
217
+ }
218
+ }
219
+
220
+ /* -----------------------------------------------------------
221
+ DEFINITIONS
222
+ ----------------------------------------------------------- */
223
+ /** JSON Schema type for Swagger. */
224
+ export type IJsonSchema =
225
+ | IJsonSchema.IBoolean
226
+ | IJsonSchema.IInteger
227
+ | IJsonSchema.INumber
228
+ | IJsonSchema.IString
229
+ | IJsonSchema.IArray
230
+ | IJsonSchema.IObject
231
+ | IJsonSchema.IReference
232
+ | IJsonSchema.IAnyOf
233
+ | IJsonSchema.IOneOf
234
+ | IJsonSchema.INullOnly
235
+ | IJsonSchema.IUnknown;
236
+ export namespace IJsonSchema {
237
+ /** Boolean type. */
238
+ export interface IBoolean
239
+ extends
240
+ Omit<IJsonSchemaAttribute.IBoolean, "examples">,
241
+ __ISignificant<"boolean"> {
242
+ /** Default value. */
243
+ default?: boolean | null;
244
+
245
+ /** Allowed values. */
246
+ enum?: Array<boolean | null>;
247
+ }
248
+
249
+ /** Integer type. */
250
+ export interface IInteger
251
+ extends
252
+ Omit<IJsonSchemaAttribute.IInteger, "examples">,
253
+ __ISignificant<"integer"> {
254
+ /** Default value. */
255
+ default?: (number & tags.Type<"int64">) | null;
256
+
257
+ /** Allowed values. */
258
+ enum?: Array<(number & tags.Type<"int64">) | null>;
259
+
260
+ /** Minimum value. */
261
+ minimum?: number & tags.Type<"int64">;
262
+
263
+ /** Maximum value. */
264
+ maximum?: number & tags.Type<"int64">;
265
+
266
+ /** Exclusive minimum. */
267
+ exclusiveMinimum?: number | boolean;
268
+
269
+ /** Exclusive maximum. */
270
+ exclusiveMaximum?: number | boolean;
271
+
272
+ /** Multiple of constraint. */
273
+ multipleOf?: number & tags.ExclusiveMinimum<0>;
274
+ }
275
+
276
+ /** Number (double) type. */
277
+ export interface INumber
278
+ extends
279
+ Omit<IJsonSchemaAttribute.INumber, "examples">,
280
+ __ISignificant<"number"> {
281
+ /** Default value. */
282
+ default?: number | null;
283
+
284
+ /** Allowed values. */
285
+ enum?: Array<number | null>;
286
+
287
+ /** Minimum value. */
288
+ minimum?: number;
289
+
290
+ /** Maximum value. */
291
+ maximum?: number;
292
+
293
+ /** Exclusive minimum. */
294
+ exclusiveMinimum?: number | boolean;
295
+
296
+ /** Exclusive maximum. */
297
+ exclusiveMaximum?: number | boolean;
298
+
299
+ /** Multiple of constraint. */
300
+ multipleOf?: number & tags.ExclusiveMinimum<0>;
301
+ }
302
+
303
+ /** String type. */
304
+ export interface IString
305
+ extends
306
+ Omit<IJsonSchemaAttribute.IString, "examples">,
307
+ __ISignificant<"string"> {
308
+ /** Default value. */
309
+ default?: string | null;
310
+
311
+ /** Allowed values. */
312
+ enum?: Array<string | null>;
313
+
314
+ /** String format. */
315
+ format?:
316
+ | "binary"
317
+ | "byte"
318
+ | "password"
319
+ | "regex"
320
+ | "uuid"
321
+ | "email"
322
+ | "hostname"
323
+ | "idn-email"
324
+ | "idn-hostname"
325
+ | "iri"
326
+ | "iri-reference"
327
+ | "ipv4"
328
+ | "ipv6"
329
+ | "uri"
330
+ | "uri-reference"
331
+ | "uri-template"
332
+ | "url"
333
+ | "date-time"
334
+ | "date"
335
+ | "time"
336
+ | "duration"
337
+ | "json-pointer"
338
+ | "relative-json-pointer"
339
+ | (string & {});
340
+
341
+ /** Regex pattern. */
342
+ pattern?: string;
343
+
344
+ /** Minimum length. */
345
+ minLength?: number & tags.Type<"uint64">;
346
+
347
+ /** Maximum length. */
348
+ maxLength?: number & tags.Type<"uint64">;
349
+ }
350
+
351
+ /** Array type. */
352
+ export interface IArray
353
+ extends
354
+ Omit<IJsonSchemaAttribute.IArray, "examples">,
355
+ __ISignificant<"array"> {
356
+ /** Element type. */
357
+ items: IJsonSchema;
358
+
359
+ /** Whether elements must be unique. */
360
+ uniqueItems?: boolean;
361
+
362
+ /** Minimum items. */
363
+ minItems?: number & tags.Type<"uint64">;
364
+
365
+ /** Maximum items. */
366
+ maxItems?: number & tags.Type<"uint64">;
367
+ }
368
+
369
+ /** Object type. */
370
+ export interface IObject
371
+ extends
372
+ Omit<IJsonSchemaAttribute.IObject, "examples">,
373
+ __ISignificant<"object"> {
374
+ /** Property schemas. */
375
+ properties?: Record<string, IJsonSchema>;
376
+
377
+ /** Required property names. */
378
+ required?: string[];
379
+
380
+ /** Additional properties schema. */
381
+ additionalProperties?: boolean | IJsonSchema;
382
+
383
+ /** Maximum properties. */
384
+ maxProperties?: number;
385
+
386
+ /** Minimum properties. */
387
+ minProperties?: number;
388
+ }
389
+
390
+ /** Reference to a named schema. */
391
+ export interface IReference<Key = string> extends __IAttribute {
392
+ /** Reference path. */
393
+ $ref: Key;
394
+ }
395
+
396
+ /** All-of combination. */
397
+ export interface IAllOf extends __IAttribute {
398
+ /** Schemas to combine. */
399
+ allOf: IJsonSchema[];
400
+ }
401
+
402
+ /** Any-of union (Swagger extension). */
403
+ export interface IAnyOf extends __IAttribute {
404
+ /** Union member schemas. */
405
+ "x-anyOf": IJsonSchema[];
406
+ }
407
+
408
+ /** One-of union (Swagger extension). */
409
+ export interface IOneOf extends __IAttribute {
410
+ /** Union member schemas. */
411
+ "x-oneOf": IJsonSchema[];
412
+ }
413
+
414
+ /** Null type. */
415
+ export interface INullOnly extends __IAttribute {
416
+ /** Type discriminator. */
417
+ type: "null";
418
+
419
+ /** Default value. */
420
+ default?: null;
421
+ }
422
+
423
+ /** Unknown type. */
424
+ export interface IUnknown extends __IAttribute {
425
+ /** Type discriminator (undefined for unknown). */
426
+ type?: undefined;
427
+ }
428
+
429
+ /** @internal Base interface with type discriminator. */
430
+ export interface __ISignificant<Type extends string> extends __IAttribute {
431
+ /** Type discriminator. */
432
+ type: Type;
433
+
434
+ /** Nullable flag (Swagger extension). */
435
+ "x-nullable"?: boolean;
436
+ }
437
+
438
+ /** @internal Base attribute interface. */
439
+ export interface __IAttribute extends Omit<
440
+ IJsonSchemaAttribute,
441
+ "examples" | "writeOnly"
442
+ > {
443
+ /** Example values. */
444
+ examples?: any[];
445
+ }
446
+ }
447
+
448
+ /** Security scheme types. */
449
+ export type ISecurityDefinition =
450
+ | ISecurityDefinition.IApiKey
451
+ | ISecurityDefinition.IBasic
452
+ | ISecurityDefinition.IOauth2Implicit
453
+ | ISecurityDefinition.IOauth2AccessCode
454
+ | ISecurityDefinition.IOauth2Password
455
+ | ISecurityDefinition.IOauth2Application;
456
+ export namespace ISecurityDefinition {
457
+ /** API key authentication. */
458
+ export interface IApiKey {
459
+ /** Scheme type. */
460
+ type: "apiKey";
461
+
462
+ /** Key location. */
463
+ in?: "header" | "query" | "cookie";
464
+
465
+ /** Key name. */
466
+ name?: string;
467
+
468
+ /** Scheme description. */
469
+ description?: string;
470
+ }
471
+
472
+ /** HTTP basic authentication. */
473
+ export interface IBasic {
474
+ /** Scheme type. */
475
+ type: "basic";
476
+
477
+ /** Scheme name. */
478
+ name?: string;
479
+
480
+ /** Scheme description. */
481
+ description?: string;
482
+ }
483
+
484
+ /** OAuth2 implicit flow. */
485
+ export interface IOauth2Implicit {
486
+ /** Scheme type. */
487
+ type: "oauth2";
488
+
489
+ /** OAuth2 flow type. */
490
+ flow: "implicit";
491
+
492
+ /** Authorization URL. */
493
+ authorizationUrl?: string;
494
+
495
+ /** Available scopes. */
496
+ scopes?: Record<string, string>;
497
+
498
+ /** Scheme description. */
499
+ description?: string;
500
+ }
501
+
502
+ /** OAuth2 authorization code flow. */
503
+ export interface IOauth2AccessCode {
504
+ /** Scheme type. */
505
+ type: "oauth2";
506
+
507
+ /** OAuth2 flow type. */
508
+ flow: "accessCode";
509
+
510
+ /** Authorization URL. */
511
+ authorizationUrl?: string;
512
+
513
+ /** Token URL. */
514
+ tokenUrl?: string;
515
+
516
+ /** Available scopes. */
517
+ scopes?: Record<string, string>;
518
+
519
+ /** Scheme description. */
520
+ description?: string;
521
+ }
522
+
523
+ /** OAuth2 password flow. */
524
+ export interface IOauth2Password {
525
+ /** Scheme type. */
526
+ type: "oauth2";
527
+
528
+ /** OAuth2 flow type. */
529
+ flow: "password";
530
+
531
+ /** Token URL. */
532
+ tokenUrl?: string;
533
+
534
+ /** Available scopes. */
535
+ scopes?: Record<string, string>;
536
+
537
+ /** Scheme description. */
538
+ description?: string;
539
+ }
540
+
541
+ /** OAuth2 application (client credentials) flow. */
542
+ export interface IOauth2Application {
543
+ /** Scheme type. */
544
+ type: "oauth2";
545
+
546
+ /** OAuth2 flow type. */
547
+ flow: "application";
548
+
549
+ /** Token URL. */
550
+ tokenUrl?: string;
551
+
552
+ /** Available scopes. */
553
+ scopes?: Record<string, string>;
554
+
555
+ /** Scheme description. */
556
+ description?: string;
557
+ }
558
+ }
559
+ }