zod-openapi 2.19.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,938 +1,6 @@
1
- import { ZodType, AnyZodObject, ZodTypeDef, ZodTypeAny, z, ZodDate, ZodObject } from 'zod';
2
-
3
- type IExtensionName = `x-${string}`;
4
- type IExtensionType = any;
5
- type ISpecificationExtension = {
6
- [extensionName: IExtensionName]: IExtensionType;
7
- };
8
-
9
- interface ServerObject extends ISpecificationExtension {
10
- url: string;
11
- description?: string;
12
- variables?: {
13
- [v: string]: ServerVariableObject;
14
- };
15
- }
16
- interface ServerVariableObject extends ISpecificationExtension {
17
- enum?: string[] | boolean[] | number[];
18
- default: string | boolean | number;
19
- description?: string;
20
- }
21
-
22
- interface OpenAPIObject$1 extends ISpecificationExtension {
23
- openapi: string;
24
- info: InfoObject$1;
25
- servers?: ServerObject[];
26
- paths: PathsObject$1;
27
- components?: ComponentsObject$2;
28
- security?: SecurityRequirementObject$1[];
29
- tags?: TagObject$1[];
30
- externalDocs?: ExternalDocumentationObject$1;
31
- }
32
- interface InfoObject$1 extends ISpecificationExtension {
33
- title: string;
34
- description?: string;
35
- termsOfService?: string;
36
- contact?: ContactObject$1;
37
- license?: LicenseObject$1;
38
- version: string;
39
- }
40
- interface ContactObject$1 extends ISpecificationExtension {
41
- name?: string;
42
- url?: string;
43
- email?: string;
44
- }
45
- interface LicenseObject$1 extends ISpecificationExtension {
46
- name: string;
47
- url?: string;
48
- }
49
- interface ComponentsObject$2 extends ISpecificationExtension {
50
- schemas?: {
51
- [schema: string]: SchemaObject$2 | ReferenceObject$1;
52
- };
53
- responses?: {
54
- [response: string]: ResponseObject$1 | ReferenceObject$1;
55
- };
56
- parameters?: {
57
- [parameter: string]: ParameterObject$1 | ReferenceObject$1;
58
- };
59
- examples?: {
60
- [example: string]: ExampleObject$1 | ReferenceObject$1;
61
- };
62
- requestBodies?: {
63
- [request: string]: RequestBodyObject$1 | ReferenceObject$1;
64
- };
65
- headers?: {
66
- [header: string]: HeaderObject$1 | ReferenceObject$1;
67
- };
68
- securitySchemes?: {
69
- [securityScheme: string]: SecuritySchemeObject$1 | ReferenceObject$1;
70
- };
71
- links?: {
72
- [link: string]: LinkObject$1 | ReferenceObject$1;
73
- };
74
- callbacks?: {
75
- [callback: string]: CallbackObject$1 | ReferenceObject$1;
76
- };
77
- }
78
- interface PathsObject$1 extends ISpecificationExtension {
79
- [path: string]: PathItemObject$1;
80
- }
81
- type PathObject$1 = PathsObject$1;
82
- interface PathItemObject$1 extends ISpecificationExtension {
83
- $ref?: string;
84
- summary?: string;
85
- description?: string;
86
- get?: OperationObject$1;
87
- put?: OperationObject$1;
88
- post?: OperationObject$1;
89
- delete?: OperationObject$1;
90
- options?: OperationObject$1;
91
- head?: OperationObject$1;
92
- patch?: OperationObject$1;
93
- trace?: OperationObject$1;
94
- servers?: ServerObject[];
95
- parameters?: (ParameterObject$1 | ReferenceObject$1)[];
96
- }
97
- interface OperationObject$1 extends ISpecificationExtension {
98
- tags?: string[];
99
- summary?: string;
100
- description?: string;
101
- externalDocs?: ExternalDocumentationObject$1;
102
- operationId?: string;
103
- parameters?: (ParameterObject$1 | ReferenceObject$1)[];
104
- requestBody?: RequestBodyObject$1 | ReferenceObject$1;
105
- responses: ResponsesObject$1;
106
- callbacks?: CallbacksObject$1;
107
- deprecated?: boolean;
108
- security?: SecurityRequirementObject$1[];
109
- servers?: ServerObject[];
110
- }
111
- interface ExternalDocumentationObject$1 extends ISpecificationExtension {
112
- description?: string;
113
- url: string;
114
- }
115
- type ParameterLocation$1 = 'query' | 'header' | 'path' | 'cookie';
116
- type ParameterStyle$1 = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
117
- interface BaseParameterObject$1 extends ISpecificationExtension {
118
- description?: string;
119
- required?: boolean;
120
- deprecated?: boolean;
121
- allowEmptyValue?: boolean;
122
- style?: ParameterStyle$1;
123
- explode?: boolean;
124
- allowReserved?: boolean;
125
- schema?: SchemaObject$2 | ReferenceObject$1;
126
- examples?: {
127
- [param: string]: ExampleObject$1 | ReferenceObject$1;
128
- };
129
- example?: any;
130
- content?: ContentObject$1;
131
- }
132
- interface ParameterObject$1 extends BaseParameterObject$1 {
133
- name: string;
134
- in: ParameterLocation$1;
135
- }
136
- interface RequestBodyObject$1 extends ISpecificationExtension {
137
- description?: string;
138
- content: ContentObject$1;
139
- required?: boolean;
140
- }
141
- interface ContentObject$1 {
142
- [mediatype: string]: MediaTypeObject$1;
143
- }
144
- interface MediaTypeObject$1 extends ISpecificationExtension {
145
- schema?: SchemaObject$2 | ReferenceObject$1;
146
- examples?: ExamplesObject$1;
147
- example?: any;
148
- encoding?: EncodingObject$1;
149
- }
150
- interface EncodingObject$1 extends ISpecificationExtension {
151
- [property: string]: EncodingPropertyObject$1 | any;
152
- }
153
- interface EncodingPropertyObject$1 {
154
- contentType?: string;
155
- headers?: {
156
- [key: string]: HeaderObject$1 | ReferenceObject$1;
157
- };
158
- style?: string;
159
- explode?: boolean;
160
- allowReserved?: boolean;
161
- [key: string]: any;
162
- }
163
- interface ResponsesObject$1 extends ISpecificationExtension {
164
- default?: ResponseObject$1 | ReferenceObject$1;
165
- [statuscode: string]: ResponseObject$1 | ReferenceObject$1 | any;
166
- }
167
- interface ResponseObject$1 extends ISpecificationExtension {
168
- description: string;
169
- headers?: HeadersObject$1;
170
- content?: ContentObject$1;
171
- links?: LinksObject$1;
172
- }
173
- interface CallbacksObject$1 extends ISpecificationExtension {
174
- [name: string]: CallbackObject$1 | ReferenceObject$1 | any;
175
- }
176
- interface CallbackObject$1 extends ISpecificationExtension {
177
- [name: string]: PathItemObject$1 | any;
178
- }
179
- interface HeadersObject$1 {
180
- [name: string]: HeaderObject$1 | ReferenceObject$1;
181
- }
182
- interface ExampleObject$1 {
183
- summary?: string;
184
- description?: string;
185
- value?: any;
186
- externalValue?: string;
187
- [property: string]: any;
188
- }
189
- interface LinksObject$1 {
190
- [name: string]: LinkObject$1 | ReferenceObject$1;
191
- }
192
- interface LinkObject$1 extends ISpecificationExtension {
193
- operationRef?: string;
194
- operationId?: string;
195
- parameters?: LinkParametersObject$1;
196
- requestBody?: any | string;
197
- description?: string;
198
- server?: ServerObject;
199
- [property: string]: any;
200
- }
201
- interface LinkParametersObject$1 {
202
- [name: string]: any | string;
203
- }
204
- interface HeaderObject$1 extends BaseParameterObject$1 {
205
- $ref?: string;
206
- }
207
- interface TagObject$1 extends ISpecificationExtension {
208
- name: string;
209
- description?: string;
210
- externalDocs?: ExternalDocumentationObject$1;
211
- [extension: string]: any;
212
- }
213
- interface ExamplesObject$1 {
214
- [name: string]: ExampleObject$1 | ReferenceObject$1;
215
- }
216
- interface ReferenceObject$1 {
217
- $ref: string;
218
- }
219
- type SchemaObjectType$1 = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
220
- type SchemaObjectFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
221
- interface SchemaObject$2 extends ISpecificationExtension {
222
- nullable?: boolean;
223
- discriminator?: DiscriminatorObject$1;
224
- readOnly?: boolean;
225
- writeOnly?: boolean;
226
- xml?: XmlObject$1;
227
- externalDocs?: ExternalDocumentationObject$1;
228
- example?: any;
229
- examples?: any[];
230
- deprecated?: boolean;
231
- type?: SchemaObjectType$1 | SchemaObjectType$1[];
232
- format?: SchemaObjectFormat;
233
- allOf?: (SchemaObject$2 | ReferenceObject$1)[];
234
- oneOf?: (SchemaObject$2 | ReferenceObject$1)[];
235
- anyOf?: (SchemaObject$2 | ReferenceObject$1)[];
236
- not?: SchemaObject$2 | ReferenceObject$1;
237
- items?: SchemaObject$2 | ReferenceObject$1;
238
- properties?: {
239
- [propertyName: string]: SchemaObject$2 | ReferenceObject$1;
240
- };
241
- additionalProperties?: SchemaObject$2 | ReferenceObject$1 | boolean;
242
- description?: string;
243
- default?: any;
244
- title?: string;
245
- multipleOf?: number;
246
- maximum?: number;
247
- exclusiveMaximum?: boolean;
248
- minimum?: number;
249
- exclusiveMinimum?: boolean;
250
- maxLength?: number;
251
- minLength?: number;
252
- pattern?: string;
253
- maxItems?: number;
254
- minItems?: number;
255
- uniqueItems?: boolean;
256
- maxProperties?: number;
257
- minProperties?: number;
258
- required?: string[];
259
- enum?: any[];
260
- }
261
- interface SchemasObject$1 {
262
- [schema: string]: SchemaObject$2;
263
- }
264
- interface DiscriminatorObject$1 {
265
- propertyName: string;
266
- mapping?: {
267
- [key: string]: string;
268
- };
269
- }
270
- interface XmlObject$1 extends ISpecificationExtension {
271
- name?: string;
272
- namespace?: string;
273
- prefix?: string;
274
- attribute?: boolean;
275
- wrapped?: boolean;
276
- }
277
- type SecuritySchemeType$1 = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
278
- interface SecuritySchemeObject$1 extends ISpecificationExtension {
279
- type: SecuritySchemeType$1;
280
- description?: string;
281
- name?: string;
282
- in?: string;
283
- scheme?: string;
284
- bearerFormat?: string;
285
- flows?: OAuthFlowsObject$1;
286
- openIdConnectUrl?: string;
287
- }
288
- interface OAuthFlowsObject$1 extends ISpecificationExtension {
289
- implicit?: OAuthFlowObject$1;
290
- password?: OAuthFlowObject$1;
291
- clientCredentials?: OAuthFlowObject$1;
292
- authorizationCode?: OAuthFlowObject$1;
293
- }
294
- interface OAuthFlowObject$1 extends ISpecificationExtension {
295
- authorizationUrl?: string;
296
- tokenUrl?: string;
297
- refreshUrl?: string;
298
- scopes: ScopesObject$1;
299
- }
300
- interface ScopesObject$1 extends ISpecificationExtension {
301
- [scope: string]: any;
302
- }
303
- interface SecurityRequirementObject$1 {
304
- [name: string]: string[];
305
- }
306
-
307
- type oas30_IExtensionName = IExtensionName;
308
- type oas30_IExtensionType = IExtensionType;
309
- type oas30_ISpecificationExtension = ISpecificationExtension;
310
- type oas30_SchemaObjectFormat = SchemaObjectFormat;
311
- type oas30_ServerObject = ServerObject;
312
- type oas30_ServerVariableObject = ServerVariableObject;
313
- declare namespace oas30 {
314
- export type { BaseParameterObject$1 as BaseParameterObject, CallbackObject$1 as CallbackObject, CallbacksObject$1 as CallbacksObject, ComponentsObject$2 as ComponentsObject, ContactObject$1 as ContactObject, ContentObject$1 as ContentObject, DiscriminatorObject$1 as DiscriminatorObject, EncodingObject$1 as EncodingObject, EncodingPropertyObject$1 as EncodingPropertyObject, ExampleObject$1 as ExampleObject, ExamplesObject$1 as ExamplesObject, ExternalDocumentationObject$1 as ExternalDocumentationObject, HeaderObject$1 as HeaderObject, HeadersObject$1 as HeadersObject, oas30_IExtensionName as IExtensionName, oas30_IExtensionType as IExtensionType, oas30_ISpecificationExtension as ISpecificationExtension, InfoObject$1 as InfoObject, LicenseObject$1 as LicenseObject, LinkObject$1 as LinkObject, LinkParametersObject$1 as LinkParametersObject, LinksObject$1 as LinksObject, MediaTypeObject$1 as MediaTypeObject, OAuthFlowObject$1 as OAuthFlowObject, OAuthFlowsObject$1 as OAuthFlowsObject, OpenAPIObject$1 as OpenAPIObject, OperationObject$1 as OperationObject, ParameterLocation$1 as ParameterLocation, ParameterObject$1 as ParameterObject, ParameterStyle$1 as ParameterStyle, PathItemObject$1 as PathItemObject, PathObject$1 as PathObject, PathsObject$1 as PathsObject, ReferenceObject$1 as ReferenceObject, RequestBodyObject$1 as RequestBodyObject, ResponseObject$1 as ResponseObject, ResponsesObject$1 as ResponsesObject, SchemaObject$2 as SchemaObject, oas30_SchemaObjectFormat as SchemaObjectFormat, SchemaObjectType$1 as SchemaObjectType, SchemasObject$1 as SchemasObject, ScopesObject$1 as ScopesObject, SecurityRequirementObject$1 as SecurityRequirementObject, SecuritySchemeObject$1 as SecuritySchemeObject, SecuritySchemeType$1 as SecuritySchemeType, oas30_ServerObject as ServerObject, oas30_ServerVariableObject as ServerVariableObject, TagObject$1 as TagObject, XmlObject$1 as XmlObject };
315
- }
316
-
317
- interface OpenAPIObject extends ISpecificationExtension {
318
- openapi: string;
319
- info: InfoObject;
320
- servers?: ServerObject[];
321
- paths?: PathsObject;
322
- components?: ComponentsObject$1;
323
- security?: SecurityRequirementObject[];
324
- tags?: TagObject[];
325
- externalDocs?: ExternalDocumentationObject;
326
- webhooks?: PathsObject;
327
- }
328
- interface InfoObject extends ISpecificationExtension {
329
- title: string;
330
- description?: string;
331
- termsOfService?: string;
332
- contact?: ContactObject;
333
- license?: LicenseObject;
334
- version: string;
335
- }
336
- interface ContactObject extends ISpecificationExtension {
337
- name?: string;
338
- url?: string;
339
- email?: string;
340
- }
341
- interface LicenseObject extends ISpecificationExtension {
342
- name: string;
343
- identifier?: string;
344
- url?: string;
345
- }
346
- interface ComponentsObject$1 extends ISpecificationExtension {
347
- schemas?: {
348
- [schema: string]: SchemaObject$1 | ReferenceObject;
349
- };
350
- responses?: {
351
- [response: string]: ResponseObject | ReferenceObject;
352
- };
353
- parameters?: {
354
- [parameter: string]: ParameterObject | ReferenceObject;
355
- };
356
- examples?: {
357
- [example: string]: ExampleObject | ReferenceObject;
358
- };
359
- requestBodies?: {
360
- [request: string]: RequestBodyObject | ReferenceObject;
361
- };
362
- headers?: {
363
- [header: string]: HeaderObject | ReferenceObject;
364
- };
365
- securitySchemes?: {
366
- [securityScheme: string]: SecuritySchemeObject | ReferenceObject;
367
- };
368
- links?: {
369
- [link: string]: LinkObject | ReferenceObject;
370
- };
371
- callbacks?: {
372
- [callback: string]: CallbackObject | ReferenceObject;
373
- };
374
- }
375
- interface PathsObject extends ISpecificationExtension {
376
- [path: string]: PathItemObject;
377
- }
378
- type PathObject = PathsObject;
379
- interface PathItemObject extends ISpecificationExtension {
380
- $ref?: string;
381
- summary?: string;
382
- description?: string;
383
- get?: OperationObject;
384
- put?: OperationObject;
385
- post?: OperationObject;
386
- delete?: OperationObject;
387
- options?: OperationObject;
388
- head?: OperationObject;
389
- patch?: OperationObject;
390
- trace?: OperationObject;
391
- servers?: ServerObject[];
392
- parameters?: (ParameterObject | ReferenceObject)[];
393
- }
394
- interface OperationObject extends ISpecificationExtension {
395
- tags?: string[];
396
- summary?: string;
397
- description?: string;
398
- externalDocs?: ExternalDocumentationObject;
399
- operationId?: string;
400
- parameters?: (ParameterObject | ReferenceObject)[];
401
- requestBody?: RequestBodyObject | ReferenceObject;
402
- responses?: ResponsesObject;
403
- callbacks?: CallbacksObject;
404
- deprecated?: boolean;
405
- security?: SecurityRequirementObject[];
406
- servers?: ServerObject[];
407
- }
408
- interface ExternalDocumentationObject extends ISpecificationExtension {
409
- description?: string;
410
- url: string;
411
- }
412
- type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
413
- type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
414
- interface BaseParameterObject extends ISpecificationExtension {
415
- description?: string;
416
- required?: boolean;
417
- deprecated?: boolean;
418
- allowEmptyValue?: boolean;
419
- style?: ParameterStyle;
420
- explode?: boolean;
421
- allowReserved?: boolean;
422
- schema?: SchemaObject$1 | ReferenceObject;
423
- examples?: {
424
- [param: string]: ExampleObject | ReferenceObject;
425
- };
426
- example?: any;
427
- content?: ContentObject;
428
- }
429
- interface ParameterObject extends BaseParameterObject {
430
- name: string;
431
- in: ParameterLocation;
432
- }
433
- interface RequestBodyObject extends ISpecificationExtension {
434
- description?: string;
435
- content: ContentObject;
436
- required?: boolean;
437
- }
438
- interface ContentObject {
439
- [mediatype: string]: MediaTypeObject;
440
- }
441
- interface MediaTypeObject extends ISpecificationExtension {
442
- schema?: SchemaObject$1 | ReferenceObject;
443
- examples?: ExamplesObject;
444
- example?: any;
445
- encoding?: EncodingObject;
446
- }
447
- interface EncodingObject extends ISpecificationExtension {
448
- [property: string]: EncodingPropertyObject | any;
449
- }
450
- interface EncodingPropertyObject {
451
- contentType?: string;
452
- headers?: {
453
- [key: string]: HeaderObject | ReferenceObject;
454
- };
455
- style?: string;
456
- explode?: boolean;
457
- allowReserved?: boolean;
458
- [key: string]: any;
459
- }
460
- interface ResponsesObject extends ISpecificationExtension {
461
- default?: ResponseObject | ReferenceObject;
462
- [statuscode: string]: ResponseObject | ReferenceObject | any;
463
- }
464
- interface ResponseObject extends ISpecificationExtension {
465
- description: string;
466
- headers?: HeadersObject;
467
- content?: ContentObject;
468
- links?: LinksObject;
469
- }
470
- interface CallbacksObject extends ISpecificationExtension {
471
- [name: string]: CallbackObject | ReferenceObject | any;
472
- }
473
- interface CallbackObject extends ISpecificationExtension {
474
- [name: string]: PathItemObject | any;
475
- }
476
- interface HeadersObject {
477
- [name: string]: HeaderObject | ReferenceObject;
478
- }
479
- interface ExampleObject {
480
- summary?: string;
481
- description?: string;
482
- value?: any;
483
- externalValue?: string;
484
- [property: string]: any;
485
- }
486
- interface LinksObject {
487
- [name: string]: LinkObject | ReferenceObject;
488
- }
489
- interface LinkObject extends ISpecificationExtension {
490
- operationRef?: string;
491
- operationId?: string;
492
- parameters?: LinkParametersObject;
493
- requestBody?: any | string;
494
- description?: string;
495
- server?: ServerObject;
496
- [property: string]: any;
497
- }
498
- interface LinkParametersObject {
499
- [name: string]: any | string;
500
- }
501
- interface HeaderObject extends BaseParameterObject {
502
- $ref?: string;
503
- }
504
- interface TagObject extends ISpecificationExtension {
505
- name: string;
506
- description?: string;
507
- externalDocs?: ExternalDocumentationObject;
508
- [extension: string]: any;
509
- }
510
- interface ExamplesObject {
511
- [name: string]: ExampleObject | ReferenceObject;
512
- }
513
- interface ReferenceObject {
514
- $ref: string;
515
- summary?: string;
516
- description?: string;
517
- }
518
- type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
519
- interface SchemaObject$1 extends ISpecificationExtension {
520
- discriminator?: DiscriminatorObject;
521
- readOnly?: boolean;
522
- writeOnly?: boolean;
523
- xml?: XmlObject;
524
- externalDocs?: ExternalDocumentationObject;
525
- example?: any;
526
- examples?: any[];
527
- deprecated?: boolean;
528
- type?: SchemaObjectType | SchemaObjectType[];
529
- format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
530
- allOf?: (SchemaObject$1 | ReferenceObject)[];
531
- oneOf?: (SchemaObject$1 | ReferenceObject)[];
532
- anyOf?: (SchemaObject$1 | ReferenceObject)[];
533
- not?: SchemaObject$1 | ReferenceObject;
534
- items?: SchemaObject$1 | ReferenceObject;
535
- properties?: {
536
- [propertyName: string]: SchemaObject$1 | ReferenceObject;
537
- };
538
- additionalProperties?: SchemaObject$1 | ReferenceObject | boolean;
539
- propertyNames?: SchemaObject$1 | ReferenceObject;
540
- description?: string;
541
- default?: any;
542
- title?: string;
543
- multipleOf?: number;
544
- maximum?: number;
545
- const?: any;
546
- exclusiveMaximum?: number;
547
- minimum?: number;
548
- exclusiveMinimum?: number;
549
- maxLength?: number;
550
- minLength?: number;
551
- pattern?: string;
552
- maxItems?: number;
553
- minItems?: number;
554
- uniqueItems?: boolean;
555
- maxProperties?: number;
556
- minProperties?: number;
557
- required?: string[];
558
- enum?: any[];
559
- prefixItems?: (SchemaObject$1 | ReferenceObject)[];
560
- contentMediaType?: string;
561
- contentEncoding?: string;
562
- }
563
- interface SchemasObject {
564
- [schema: string]: SchemaObject$1;
565
- }
566
- interface DiscriminatorObject {
567
- propertyName: string;
568
- mapping?: {
569
- [key: string]: string;
570
- };
571
- }
572
- interface XmlObject extends ISpecificationExtension {
573
- name?: string;
574
- namespace?: string;
575
- prefix?: string;
576
- attribute?: boolean;
577
- wrapped?: boolean;
578
- }
579
- type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
580
- interface SecuritySchemeObject extends ISpecificationExtension {
581
- type: SecuritySchemeType;
582
- description?: string;
583
- name?: string;
584
- in?: string;
585
- scheme?: string;
586
- bearerFormat?: string;
587
- flows?: OAuthFlowsObject;
588
- openIdConnectUrl?: string;
589
- }
590
- interface OAuthFlowsObject extends ISpecificationExtension {
591
- implicit?: OAuthFlowObject;
592
- password?: OAuthFlowObject;
593
- clientCredentials?: OAuthFlowObject;
594
- authorizationCode?: OAuthFlowObject;
595
- }
596
- interface OAuthFlowObject extends ISpecificationExtension {
597
- authorizationUrl?: string;
598
- tokenUrl?: string;
599
- refreshUrl?: string;
600
- scopes: ScopesObject;
601
- }
602
- interface ScopesObject extends ISpecificationExtension {
603
- [scope: string]: any;
604
- }
605
- interface SecurityRequirementObject {
606
- [name: string]: string[];
607
- }
608
-
609
- type oas31_BaseParameterObject = BaseParameterObject;
610
- type oas31_CallbackObject = CallbackObject;
611
- type oas31_CallbacksObject = CallbacksObject;
612
- type oas31_ContactObject = ContactObject;
613
- type oas31_ContentObject = ContentObject;
614
- type oas31_DiscriminatorObject = DiscriminatorObject;
615
- type oas31_EncodingObject = EncodingObject;
616
- type oas31_EncodingPropertyObject = EncodingPropertyObject;
617
- type oas31_ExampleObject = ExampleObject;
618
- type oas31_ExamplesObject = ExamplesObject;
619
- type oas31_ExternalDocumentationObject = ExternalDocumentationObject;
620
- type oas31_HeaderObject = HeaderObject;
621
- type oas31_HeadersObject = HeadersObject;
622
- type oas31_IExtensionName = IExtensionName;
623
- type oas31_IExtensionType = IExtensionType;
624
- type oas31_ISpecificationExtension = ISpecificationExtension;
625
- type oas31_InfoObject = InfoObject;
626
- type oas31_LicenseObject = LicenseObject;
627
- type oas31_LinkObject = LinkObject;
628
- type oas31_LinkParametersObject = LinkParametersObject;
629
- type oas31_LinksObject = LinksObject;
630
- type oas31_MediaTypeObject = MediaTypeObject;
631
- type oas31_OAuthFlowObject = OAuthFlowObject;
632
- type oas31_OAuthFlowsObject = OAuthFlowsObject;
633
- type oas31_OpenAPIObject = OpenAPIObject;
634
- type oas31_OperationObject = OperationObject;
635
- type oas31_ParameterLocation = ParameterLocation;
636
- type oas31_ParameterObject = ParameterObject;
637
- type oas31_ParameterStyle = ParameterStyle;
638
- type oas31_PathItemObject = PathItemObject;
639
- type oas31_PathObject = PathObject;
640
- type oas31_PathsObject = PathsObject;
641
- type oas31_ReferenceObject = ReferenceObject;
642
- type oas31_RequestBodyObject = RequestBodyObject;
643
- type oas31_ResponseObject = ResponseObject;
644
- type oas31_ResponsesObject = ResponsesObject;
645
- type oas31_SchemaObjectType = SchemaObjectType;
646
- type oas31_SchemasObject = SchemasObject;
647
- type oas31_ScopesObject = ScopesObject;
648
- type oas31_SecurityRequirementObject = SecurityRequirementObject;
649
- type oas31_SecuritySchemeObject = SecuritySchemeObject;
650
- type oas31_SecuritySchemeType = SecuritySchemeType;
651
- type oas31_ServerObject = ServerObject;
652
- type oas31_ServerVariableObject = ServerVariableObject;
653
- type oas31_TagObject = TagObject;
654
- type oas31_XmlObject = XmlObject;
655
- declare namespace oas31 {
656
- export type { oas31_BaseParameterObject as BaseParameterObject, oas31_CallbackObject as CallbackObject, oas31_CallbacksObject as CallbacksObject, ComponentsObject$1 as ComponentsObject, oas31_ContactObject as ContactObject, oas31_ContentObject as ContentObject, oas31_DiscriminatorObject as DiscriminatorObject, oas31_EncodingObject as EncodingObject, oas31_EncodingPropertyObject as EncodingPropertyObject, oas31_ExampleObject as ExampleObject, oas31_ExamplesObject as ExamplesObject, oas31_ExternalDocumentationObject as ExternalDocumentationObject, oas31_HeaderObject as HeaderObject, oas31_HeadersObject as HeadersObject, oas31_IExtensionName as IExtensionName, oas31_IExtensionType as IExtensionType, oas31_ISpecificationExtension as ISpecificationExtension, oas31_InfoObject as InfoObject, oas31_LicenseObject as LicenseObject, oas31_LinkObject as LinkObject, oas31_LinkParametersObject as LinkParametersObject, oas31_LinksObject as LinksObject, oas31_MediaTypeObject as MediaTypeObject, oas31_OAuthFlowObject as OAuthFlowObject, oas31_OAuthFlowsObject as OAuthFlowsObject, oas31_OpenAPIObject as OpenAPIObject, oas31_OperationObject as OperationObject, oas31_ParameterLocation as ParameterLocation, oas31_ParameterObject as ParameterObject, oas31_ParameterStyle as ParameterStyle, oas31_PathItemObject as PathItemObject, oas31_PathObject as PathObject, oas31_PathsObject as PathsObject, oas31_ReferenceObject as ReferenceObject, oas31_RequestBodyObject as RequestBodyObject, oas31_ResponseObject as ResponseObject, oas31_ResponsesObject as ResponsesObject, SchemaObject$1 as SchemaObject, oas31_SchemaObjectType as SchemaObjectType, oas31_SchemasObject as SchemasObject, oas31_ScopesObject as ScopesObject, oas31_SecurityRequirementObject as SecurityRequirementObject, oas31_SecuritySchemeObject as SecuritySchemeObject, oas31_SecuritySchemeType as SecuritySchemeType, oas31_ServerObject as ServerObject, oas31_ServerVariableObject as ServerVariableObject, oas31_TagObject as TagObject, oas31_XmlObject as XmlObject };
657
- }
658
-
659
- declare const openApiVersions: readonly ["3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.1.0"];
660
- type OpenApiVersion = (typeof openApiVersions)[number];
661
-
662
- interface ZodOpenApiMediaTypeObject extends Omit<MediaTypeObject & MediaTypeObject$1, 'schema'> {
663
- schema?: ZodType | SchemaObject$1 | ReferenceObject;
664
- }
665
- interface ZodOpenApiContentObject {
666
- 'application/json'?: ZodOpenApiMediaTypeObject;
667
- [mediatype: string]: ZodOpenApiMediaTypeObject | undefined;
668
- }
669
- interface ZodOpenApiRequestBodyObject extends Omit<RequestBodyObject & RequestBodyObject$1, 'content'> {
670
- content: ZodOpenApiContentObject;
671
- /** Use this field to auto register this request body as a component */
672
- ref?: string;
673
- }
674
- interface ZodOpenApiResponseObject extends Omit<ResponseObject & ResponseObject$1, 'content' | 'headers'> {
675
- content?: ZodOpenApiContentObject;
676
- headers?: AnyZodObject | HeadersObject$1 | HeadersObject;
677
- /** Use this field to auto register this response object as a component */
678
- ref?: string;
679
- }
680
- interface ZodOpenApiResponsesObject extends ISpecificationExtension {
681
- default?: ZodOpenApiResponseObject | ReferenceObject | ReferenceObject$1;
682
- [statuscode: `${1 | 2 | 3 | 4 | 5}${string}`]: ZodOpenApiResponseObject | ReferenceObject;
683
- }
684
- type ZodOpenApiParameters = {
685
- [type in ParameterLocation & ParameterLocation$1]?: ZodObjectInputType;
686
- };
687
- interface ZodOpenApiCallbacksObject extends ISpecificationExtension {
688
- [name: string]: ZodOpenApiCallbackObject;
689
- }
690
- interface ZodOpenApiCallbackObject extends ISpecificationExtension {
691
- /** Use this field to auto register this callback object as a component */
692
- ref?: string;
693
- [name: string]: ZodOpenApiPathItemObject | string | undefined;
694
- }
695
- interface ZodOpenApiOperationObject extends Omit<OperationObject & OperationObject$1, 'requestBody' | 'responses' | 'parameters' | 'callbacks'> {
696
- parameters?: Array<ZodType | ParameterObject | ParameterObject$1 | ReferenceObject | ReferenceObject$1>;
697
- requestBody?: ZodOpenApiRequestBodyObject;
698
- requestParams?: ZodOpenApiParameters;
699
- responses: ZodOpenApiResponsesObject;
700
- callbacks?: ZodOpenApiCallbacksObject;
701
- }
702
- interface ZodOpenApiPathItemObject extends Omit<PathItemObject & PathItemObject$1, 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace'> {
703
- get?: ZodOpenApiOperationObject;
704
- put?: ZodOpenApiOperationObject;
705
- post?: ZodOpenApiOperationObject;
706
- delete?: ZodOpenApiOperationObject;
707
- options?: ZodOpenApiOperationObject;
708
- head?: ZodOpenApiOperationObject;
709
- patch?: ZodOpenApiOperationObject;
710
- trace?: ZodOpenApiOperationObject;
711
- }
712
- interface ZodOpenApiPathsObject extends ISpecificationExtension {
713
- [path: string]: ZodOpenApiPathItemObject;
714
- }
715
- interface ZodOpenApiComponentsObject extends Omit<ComponentsObject$1 & ComponentsObject$2, 'schemas' | 'responses' | 'requestBodies' | 'headers' | 'parameters'> {
716
- parameters?: Record<string, ZodType | ParameterObject | ParameterObject$1 | ReferenceObject | ReferenceObject$1>;
717
- schemas?: Record<string, ZodType | SchemaObject$1 | ReferenceObject | SchemaObject$2 | ReferenceObject$1>;
718
- requestBodies?: Record<string, ZodOpenApiRequestBodyObject>;
719
- headers?: Record<string, ZodType | HeaderObject | HeaderObject$1 | ReferenceObject | ReferenceObject$1>;
720
- responses?: Record<string, ZodOpenApiResponseObject>;
721
- callbacks?: Record<string, ZodOpenApiCallbackObject>;
722
- }
723
- type ZodOpenApiVersion = OpenApiVersion;
724
- interface ZodOpenApiObject extends Omit<OpenAPIObject, 'openapi' | 'paths' | 'webhooks' | 'components'> {
725
- openapi: ZodOpenApiVersion;
726
- paths?: ZodOpenApiPathsObject;
727
- webhooks?: ZodOpenApiPathsObject;
728
- components?: ZodOpenApiComponentsObject;
729
- }
730
- type ZodObjectInputType<Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Record<string, unknown>> = ZodType<Output, Def, Input>;
731
- declare const createDocument: (zodOpenApiObject: ZodOpenApiObject) => OpenAPIObject;
732
-
733
- type CreationType = 'input' | 'output';
734
- type BaseEffect = {
735
- zodType: ZodType;
736
- path: string[];
737
- };
738
- type ComponentEffect = BaseEffect & {
739
- type: 'component';
740
- };
741
- type SchemaEffect = BaseEffect & {
742
- type: 'schema';
743
- creationType: CreationType;
744
- };
745
- type Effect = ComponentEffect | SchemaEffect;
746
- type ResolvedEffect = {
747
- creationType: CreationType;
748
- path: string[];
749
- zodType: ZodType;
750
- component?: {
751
- ref: string;
752
- zodType: ZodType;
753
- path: string[];
754
- };
755
- };
756
- interface CompleteSchemaComponent extends BaseSchemaComponent {
757
- type: 'complete';
758
- schemaObject: SchemaObject$1 | ReferenceObject | SchemaObject$2 | ReferenceObject$1;
759
- /** Set when the created schemaObject is specific to a particular effect */
760
- effects?: Effect[];
761
- resolvedEffect?: ResolvedEffect;
762
- }
763
- /**
764
- *
765
- */
766
- interface ManualSchemaComponent extends BaseSchemaComponent {
767
- type: 'manual';
768
- }
769
- interface InProgressSchemaComponent extends BaseSchemaComponent {
770
- type: 'in-progress';
771
- }
772
- interface BaseSchemaComponent {
773
- ref: string;
774
- }
775
- type SchemaComponent = CompleteSchemaComponent | ManualSchemaComponent | InProgressSchemaComponent;
776
- type SchemaComponentMap = Map<ZodType, SchemaComponent>;
777
- interface CompleteParameterComponent extends BaseParameterComponent {
778
- type: 'complete';
779
- paramObject: ParameterObject | ReferenceObject | ParameterObject$1 | ReferenceObject$1;
780
- }
781
- interface PartialParameterComponent extends BaseParameterComponent {
782
- type: 'manual';
783
- }
784
- interface BaseParameterComponent {
785
- ref: string;
786
- in: ParameterLocation;
787
- name: string;
788
- }
789
- type ParameterComponent = CompleteParameterComponent | PartialParameterComponent;
790
- type ParameterComponentMap = Map<ZodType, ParameterComponent>;
791
- interface CompleteHeaderComponent extends BaseHeaderComponent {
792
- type: 'complete';
793
- headerObject: HeaderObject | ReferenceObject | HeaderObject$1 | ReferenceObject$1;
794
- }
795
- interface PartialHeaderComponent extends BaseHeaderComponent {
796
- type: 'manual';
797
- }
798
- interface BaseHeaderComponent {
799
- ref: string;
800
- }
801
- type HeaderComponent = CompleteHeaderComponent | PartialHeaderComponent;
802
- type HeaderComponentMap = Map<ZodType, HeaderComponent>;
803
- interface BaseResponseComponent {
804
- ref: string;
805
- }
806
- interface CompleteResponseComponent extends BaseResponseComponent {
807
- type: 'complete';
808
- responseObject: ResponseObject | ReferenceObject | ResponseObject$1 | ReferenceObject$1;
809
- }
810
- interface PartialResponseComponent extends BaseResponseComponent {
811
- type: 'manual';
812
- }
813
- type ResponseComponent = CompleteResponseComponent | PartialResponseComponent;
814
- type ResponseComponentMap = Map<ZodOpenApiResponseObject, ResponseComponent>;
815
- interface BaseRequestBodyComponent {
816
- ref: string;
817
- }
818
- interface CompleteRequestBodyComponent extends BaseRequestBodyComponent {
819
- type: 'complete';
820
- requestBodyObject: RequestBodyObject | ReferenceObject | RequestBodyObject$1 | ReferenceObject$1;
821
- }
822
- interface PartialRequestBodyComponent extends BaseRequestBodyComponent {
823
- type: 'manual';
824
- }
825
- type RequestBodyComponent = CompleteRequestBodyComponent | PartialRequestBodyComponent;
826
- type RequestBodyComponentMap = Map<ZodOpenApiRequestBodyObject, RequestBodyComponent>;
827
- interface BaseCallbackComponent {
828
- ref: string;
829
- }
830
- interface CompleteCallbackComponent extends BaseCallbackComponent {
831
- type: 'complete';
832
- callbackObject: ZodOpenApiCallbackObject | CallbackObject | CallbackObject$1;
833
- }
834
- interface PartialCallbackComponent extends BaseCallbackComponent {
835
- type: 'manual';
836
- }
837
- type CallbackComponent = CompleteCallbackComponent | PartialCallbackComponent;
838
- type CallbackComponentMap = Map<ZodOpenApiCallbackObject, CallbackComponent>;
839
- interface ComponentsObject {
840
- schemas: SchemaComponentMap;
841
- parameters: ParameterComponentMap;
842
- headers: HeaderComponentMap;
843
- requestBodies: RequestBodyComponentMap;
844
- responses: ResponseComponentMap;
845
- callbacks: CallbackComponentMap;
846
- openapi: ZodOpenApiVersion;
847
- }
848
- declare const getDefaultComponents: (componentsObject?: ZodOpenApiComponentsObject, openapi?: ZodOpenApiVersion) => ComponentsObject;
849
- declare const createComponents: (componentsObject: ZodOpenApiComponentsObject, components: ComponentsObject) => ComponentsObject$1 | undefined;
850
-
851
- type SchemaObject = SchemaObject$2 & SchemaObject$1;
852
- /**
853
- * zod-openapi metadata
854
- */
855
- interface ZodOpenApiMetadata<T extends ZodTypeAny, TInferred = z.input<T> | z.output<T>> extends SchemaObject {
856
- example?: TInferred;
857
- examples?: [TInferred, ...TInferred[]];
858
- default?: T extends ZodDate ? string : TInferred;
859
- /**
860
- * Used to set the output of a ZodUnion to be `oneOf` instead of `allOf`
861
- */
862
- unionOneOf?: boolean;
863
- /**
864
- * Used to output this Zod Schema in the components schemas section. Any usage of this Zod Schema will then be transformed into a $ref.
865
- */
866
- ref?: string;
867
- /**
868
- * Used when you are manually adding a Zod Schema to the components section. This controls whether this should be rendered as request (`input`) or response (`output`). Defaults to `output`
869
- */
870
- refType?: CreationType;
871
- /**
872
- * Used to set the created type of an effect.
873
- */
874
- effectType?: CreationType | (z.input<T> extends z.output<T> ? z.output<T> extends z.input<T> ? 'same' : never : never);
875
- /**
876
- * Used to set metadata for a parameter, request header or cookie
877
- */
878
- param?: Partial<ParameterObject> & {
879
- example?: TInferred;
880
- examples?: Record<string, (ExampleObject & {
881
- value: TInferred;
882
- }) | ReferenceObject>;
883
- /**
884
- * Used to output this Zod Schema in the components parameters section. Any usage of this Zod Schema will then be transformed into a $ref.
885
- */
886
- ref?: string;
887
- };
888
- /**
889
- * Used to set data for a response header
890
- */
891
- header?: Partial<HeaderObject & HeaderObject$1> & {
892
- /**
893
- * Used to output this Zod Schema in the components headers section. Any usage of this Zod Schema will then be transformed into a $ref.
894
- */
895
- ref?: string;
896
- };
897
- /**
898
- * Used to override the generated type. If this is provided no metadata will be generated.
899
- */
900
- type?: SchemaObject['type'];
901
- }
902
- interface ZodOpenApiExtendMetadata {
903
- extends: ZodObject<any, any, any, any, any>;
904
- }
905
- declare module 'zod' {
906
- interface ZodType {
907
- /**
908
- * Add OpenAPI metadata to a Zod Type
909
- */
910
- openapi<T extends ZodTypeAny>(this: T, metadata: ZodOpenApiMetadata<T>): T;
911
- }
912
- interface ZodTypeDef {
913
- /**
914
- * OpenAPI metadata
915
- */
916
- openapi?: ZodOpenApiMetadata<ZodTypeAny>;
917
- }
918
- interface ZodObjectDef {
919
- extendMetadata?: ZodOpenApiExtendMetadata;
920
- }
921
- }
922
-
923
- declare function extendZodWithOpenApi(zod: typeof z): void;
924
-
925
- declare const createMediaTypeSchema: (schemaObject: ZodType | SchemaObject$1 | ReferenceObject | undefined, components: ComponentsObject, type: CreationType, subpath: string[]) => SchemaObject$1 | ReferenceObject | undefined;
926
-
927
- declare const createParamOrRef: (zodSchema: ZodType, components: ComponentsObject, subpath: string[], type?: keyof ZodOpenApiParameters, name?: string) => ParameterObject | ReferenceObject;
928
-
929
- type api_ComponentsObject = ComponentsObject;
930
- declare const api_createComponents: typeof createComponents;
931
- declare const api_createMediaTypeSchema: typeof createMediaTypeSchema;
932
- declare const api_createParamOrRef: typeof createParamOrRef;
933
- declare const api_getDefaultComponents: typeof getDefaultComponents;
934
- declare namespace api {
935
- export { type api_ComponentsObject as ComponentsObject, api_createComponents as createComponents, api_createMediaTypeSchema as createMediaTypeSchema, api_createParamOrRef as createParamOrRef, api_getDefaultComponents as getDefaultComponents };
936
- }
937
-
938
- export { type ZodObjectInputType, type ZodOpenApiCallbackObject, type ZodOpenApiCallbacksObject, type ZodOpenApiComponentsObject, type ZodOpenApiContentObject, type ZodOpenApiMediaTypeObject, type ZodOpenApiObject, type ZodOpenApiOperationObject, type ZodOpenApiParameters, type ZodOpenApiPathItemObject, type ZodOpenApiPathsObject, type ZodOpenApiRequestBodyObject, type ZodOpenApiResponseObject, type ZodOpenApiResponsesObject, type ZodOpenApiVersion, api, createDocument, extendZodWithOpenApi, oas30, oas31 };
1
+ export { ZodObjectInputType, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiVersion, createDocument } from './create/document.js';
2
+ export { extendZodWithOpenApi } from './extendZod.js';
3
+ import * as oas30 from './openapi3-ts/dist/oas30.js';
4
+ export { oas30 };
5
+ import * as oas31 from './openapi3-ts/dist/oas31.js';
6
+ export { oas31 };