zod-openapi 2.18.0 → 2.19.0-beta.0

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