zod-openapi 5.0.0-beta.3 → 5.0.0-beta.4
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/README.md +1 -1
- package/dist/api.d.mts +22 -5
- package/dist/api.d.ts +22 -5
- package/dist/api.js +8 -0
- package/dist/api.mjs +4 -8
- package/dist/components-5_CJdR73.d.ts +543 -0
- package/dist/components-CXjVnBr-.js +782 -0
- package/dist/components-CvutxtFV.mjs +741 -0
- package/dist/components-DAYTA1Um.d.mts +543 -0
- package/dist/create/componentsSideEffects.d.mts +6 -0
- package/dist/create/componentsSideEffects.d.ts +6 -0
- package/dist/create/componentsSideEffects.js +48 -0
- package/dist/create/componentsSideEffects.mjs +48 -0
- package/dist/index.d.mts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +20 -0
- package/dist/index.mjs +17 -22
- package/dist/zod-BvA30wad.mjs +5 -0
- package/dist/zod-i2t01GF0.js +40 -0
- package/package.json +9 -26
- package/api/index.d.ts +0 -1
- package/api/package.json +0 -5
- package/dist/api.cjs +0 -8
- package/dist/components.chunk.cjs +0 -1023
- package/dist/components.chunk.mjs +0 -1024
- package/dist/create/components.d.ts +0 -65
- package/dist/create/content.d.ts +0 -10
- package/dist/create/document.d.ts +0 -97
- package/dist/create/object.d.ts +0 -5
- package/dist/create/parameters.d.ts +0 -14
- package/dist/create/schema/schema.d.ts +0 -21
- package/dist/index.cjs +0 -23
- package/dist/openapi.d.ts +0 -5
- package/dist/openapi3-ts/dist/model/oas-common.d.ts +0 -16
- package/dist/openapi3-ts/dist/model/openapi31.d.ts +0 -302
- package/dist/openapi3-ts/dist/model/specification-extension.d.ts +0 -7
- package/dist/openapi3-ts/oas31.d.ts +0 -3
- package/dist/zod.d.ts +0 -49
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A TypeScript library which uses <a href="https://github.com/colinhacks/zod">Zod<
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
<a href="https://www.npmjs.com/package/zod-openapi"><img src="https://img.shields.io/npm/v/zod-openapi"/></a>
|
|
10
10
|
<a href="https://www.npmjs.com/package/zod-openapi"><img src="https://img.shields.io/npm/dm/zod-openapi"/></a>
|
|
11
|
-
<a href="https://nodejs.org/en/"><img src="https://img.shields.io/
|
|
11
|
+
<a href="https://nodejs.org/en/"><img src="https://img.shields.io/node/v/zod-openapi"/></a>
|
|
12
12
|
<a href="https://github.com/samchungy/zod-openapi/actions/workflows/test.yml"><img src="https://github.com/samchungy/zod-openapi/actions/workflows/test.yml/badge.svg"/></a>
|
|
13
13
|
<a href="https://github.com/samchungy/zod-openapi/actions/workflows/release.yml"><img src="https://github.com/samchungy/zod-openapi/actions/workflows/release.yml/badge.svg"/></a>
|
|
14
14
|
<a href="https://github.com/seek-oss/skuba"><img src="https://img.shields.io/badge/🤿%20skuba-powered-009DC4"/></a>
|
package/dist/api.d.mts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ComponentRegistry, MediaTypeObject, Override, ParameterLocation, ParameterObject, ReferenceObject, ZodOpenApiMediaTypeObject, createComponents, createRegistry, isAnyZodType } from "./components-DAYTA1Um.mjs";
|
|
2
|
+
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
|
+
|
|
4
|
+
//#region src/create/content.d.ts
|
|
5
|
+
declare const createMediaTypeObject: (mediaTypeObject: ZodOpenApiMediaTypeObject, ctx: {
|
|
6
|
+
registry: ComponentRegistry;
|
|
7
|
+
io: "input" | "output";
|
|
8
|
+
}, path: string[]) => MediaTypeObject;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/create/parameters.d.ts
|
|
11
|
+
declare const createParameter: (parameter: $ZodType, location: {
|
|
12
|
+
in: ParameterLocation;
|
|
13
|
+
name: string;
|
|
14
|
+
} | undefined, ctx: {
|
|
15
|
+
registry: ComponentRegistry;
|
|
16
|
+
io: "input" | "output";
|
|
17
|
+
}, path: string[]) => ParameterObject | ReferenceObject;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/create/object.d.ts
|
|
20
|
+
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Override, createComponents, createMediaTypeObject, createParameter, createRegistry, isAnyZodType, unwrapZodObject };
|
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ComponentRegistry, MediaTypeObject, Override, ParameterLocation, ParameterObject, ReferenceObject, ZodOpenApiMediaTypeObject, createComponents, createRegistry, isAnyZodType } from "./components-5_CJdR73.js";
|
|
2
|
+
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
|
+
|
|
4
|
+
//#region src/create/content.d.ts
|
|
5
|
+
declare const createMediaTypeObject: (mediaTypeObject: ZodOpenApiMediaTypeObject, ctx: {
|
|
6
|
+
registry: ComponentRegistry;
|
|
7
|
+
io: "input" | "output";
|
|
8
|
+
}, path: string[]) => MediaTypeObject;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/create/parameters.d.ts
|
|
11
|
+
declare const createParameter: (parameter: $ZodType, location: {
|
|
12
|
+
in: ParameterLocation;
|
|
13
|
+
name: string;
|
|
14
|
+
} | undefined, ctx: {
|
|
15
|
+
registry: ComponentRegistry;
|
|
16
|
+
io: "input" | "output";
|
|
17
|
+
}, path: string[]) => ParameterObject | ReferenceObject;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/create/object.d.ts
|
|
20
|
+
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Override, createComponents, createMediaTypeObject, createParameter, createRegistry, isAnyZodType, unwrapZodObject };
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require('./zod-i2t01GF0.js');
|
|
2
|
+
const require_components = require('./components-CXjVnBr-.js');
|
|
3
|
+
|
|
4
|
+
exports.createComponents = require_components.createComponents;
|
|
5
|
+
exports.createMediaTypeObject = require_components.createMediaTypeObject;
|
|
6
|
+
exports.createParameter = require_components.createParameter;
|
|
7
|
+
exports.createRegistry = require_components.createRegistry;
|
|
8
|
+
exports.unwrapZodObject = require_components.unwrapZodObject;
|
package/dist/api.mjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
createParameter,
|
|
6
|
-
createRegistry,
|
|
7
|
-
unwrapZodObject
|
|
8
|
-
};
|
|
1
|
+
import "./zod-BvA30wad.mjs";
|
|
2
|
+
import { createComponents, createMediaTypeObject, createParameter, createRegistry, unwrapZodObject } from "./components-CvutxtFV.mjs";
|
|
3
|
+
|
|
4
|
+
export { createComponents, createMediaTypeObject, createParameter, createRegistry, unwrapZodObject };
|
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { $ZodType, $ZodTypes } from "zod/v4/core";
|
|
2
|
+
import { ZodType, ZodTypeDef } from "zod";
|
|
3
|
+
import { core } from "zod/v4";
|
|
4
|
+
|
|
5
|
+
//#region src/openapi3-ts/dist/model/specification-extension.d.ts
|
|
6
|
+
type IExtensionName = `x-${string}`;
|
|
7
|
+
type IExtensionType = any;
|
|
8
|
+
type ISpecificationExtension = {
|
|
9
|
+
[extensionName: IExtensionName]: IExtensionType;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/openapi3-ts/dist/model/oas-common.d.ts
|
|
13
|
+
interface ServerObject extends ISpecificationExtension {
|
|
14
|
+
url: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
variables?: {
|
|
17
|
+
[v: string]: ServerVariableObject;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface ServerVariableObject extends ISpecificationExtension {
|
|
21
|
+
enum?: string[] | boolean[] | number[];
|
|
22
|
+
default: string | boolean | number;
|
|
23
|
+
description?: string;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/openapi3-ts/dist/model/openapi31.d.ts
|
|
27
|
+
interface OpenAPIObject extends ISpecificationExtension {
|
|
28
|
+
openapi: string;
|
|
29
|
+
info: InfoObject;
|
|
30
|
+
servers?: ServerObject[];
|
|
31
|
+
paths?: PathsObject;
|
|
32
|
+
components?: ComponentsObject;
|
|
33
|
+
security?: SecurityRequirementObject[];
|
|
34
|
+
tags?: TagObject[];
|
|
35
|
+
externalDocs?: ExternalDocumentationObject;
|
|
36
|
+
webhooks?: PathsObject;
|
|
37
|
+
}
|
|
38
|
+
interface InfoObject extends ISpecificationExtension {
|
|
39
|
+
title: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
termsOfService?: string;
|
|
42
|
+
contact?: ContactObject;
|
|
43
|
+
license?: LicenseObject;
|
|
44
|
+
version: string;
|
|
45
|
+
}
|
|
46
|
+
interface ContactObject extends ISpecificationExtension {
|
|
47
|
+
name?: string;
|
|
48
|
+
url?: string;
|
|
49
|
+
email?: string;
|
|
50
|
+
}
|
|
51
|
+
interface LicenseObject extends ISpecificationExtension {
|
|
52
|
+
name: string;
|
|
53
|
+
identifier?: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ComponentsObject extends ISpecificationExtension {
|
|
57
|
+
schemas?: {
|
|
58
|
+
[schema: string]: SchemaObject | ReferenceObject;
|
|
59
|
+
};
|
|
60
|
+
responses?: {
|
|
61
|
+
[response: string]: ResponseObject | ReferenceObject;
|
|
62
|
+
};
|
|
63
|
+
parameters?: {
|
|
64
|
+
[parameter: string]: ParameterObject | ReferenceObject;
|
|
65
|
+
};
|
|
66
|
+
examples?: {
|
|
67
|
+
[example: string]: ExampleObject | ReferenceObject;
|
|
68
|
+
};
|
|
69
|
+
requestBodies?: {
|
|
70
|
+
[request: string]: RequestBodyObject | ReferenceObject;
|
|
71
|
+
};
|
|
72
|
+
headers?: {
|
|
73
|
+
[header: string]: HeaderObject | ReferenceObject;
|
|
74
|
+
};
|
|
75
|
+
securitySchemes?: {
|
|
76
|
+
[securityScheme: string]: SecuritySchemeObject | ReferenceObject;
|
|
77
|
+
};
|
|
78
|
+
links?: {
|
|
79
|
+
[link: string]: LinkObject | ReferenceObject;
|
|
80
|
+
};
|
|
81
|
+
callbacks?: {
|
|
82
|
+
[callback: string]: CallbackObject | ReferenceObject;
|
|
83
|
+
};
|
|
84
|
+
pathItems?: {
|
|
85
|
+
[pathItem: string]: PathItemObject | ReferenceObject;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
interface PathsObject extends ISpecificationExtension {
|
|
89
|
+
[path: string]: PathItemObject;
|
|
90
|
+
}
|
|
91
|
+
type PathObject = PathsObject;
|
|
92
|
+
interface PathItemObject extends ISpecificationExtension {
|
|
93
|
+
$ref?: string;
|
|
94
|
+
summary?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
get?: OperationObject;
|
|
97
|
+
put?: OperationObject;
|
|
98
|
+
post?: OperationObject;
|
|
99
|
+
delete?: OperationObject;
|
|
100
|
+
options?: OperationObject;
|
|
101
|
+
head?: OperationObject;
|
|
102
|
+
patch?: OperationObject;
|
|
103
|
+
trace?: OperationObject;
|
|
104
|
+
servers?: ServerObject[];
|
|
105
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
106
|
+
}
|
|
107
|
+
interface OperationObject extends ISpecificationExtension {
|
|
108
|
+
tags?: string[];
|
|
109
|
+
summary?: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
externalDocs?: ExternalDocumentationObject;
|
|
112
|
+
operationId?: string;
|
|
113
|
+
parameters?: (ParameterObject | ReferenceObject)[];
|
|
114
|
+
requestBody?: RequestBodyObject | ReferenceObject;
|
|
115
|
+
responses?: ResponsesObject;
|
|
116
|
+
callbacks?: CallbacksObject;
|
|
117
|
+
deprecated?: boolean;
|
|
118
|
+
security?: SecurityRequirementObject[];
|
|
119
|
+
servers?: ServerObject[];
|
|
120
|
+
}
|
|
121
|
+
interface ExternalDocumentationObject extends ISpecificationExtension {
|
|
122
|
+
description?: string;
|
|
123
|
+
url: string;
|
|
124
|
+
}
|
|
125
|
+
type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
126
|
+
type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
127
|
+
interface BaseParameterObject extends ISpecificationExtension {
|
|
128
|
+
description?: string;
|
|
129
|
+
required?: boolean;
|
|
130
|
+
deprecated?: boolean;
|
|
131
|
+
allowEmptyValue?: boolean;
|
|
132
|
+
style?: ParameterStyle;
|
|
133
|
+
explode?: boolean;
|
|
134
|
+
allowReserved?: boolean;
|
|
135
|
+
schema?: SchemaObject | ReferenceObject;
|
|
136
|
+
examples?: {
|
|
137
|
+
[param: string]: ExampleObject | ReferenceObject;
|
|
138
|
+
};
|
|
139
|
+
example?: any;
|
|
140
|
+
content?: ContentObject;
|
|
141
|
+
}
|
|
142
|
+
interface ParameterObject extends BaseParameterObject {
|
|
143
|
+
name: string;
|
|
144
|
+
in: ParameterLocation;
|
|
145
|
+
}
|
|
146
|
+
interface RequestBodyObject extends ISpecificationExtension {
|
|
147
|
+
description?: string;
|
|
148
|
+
content: ContentObject;
|
|
149
|
+
required?: boolean;
|
|
150
|
+
}
|
|
151
|
+
interface ContentObject {
|
|
152
|
+
[mediatype: string]: MediaTypeObject;
|
|
153
|
+
}
|
|
154
|
+
interface MediaTypeObject extends ISpecificationExtension {
|
|
155
|
+
schema?: SchemaObject | ReferenceObject;
|
|
156
|
+
examples?: ExamplesObject;
|
|
157
|
+
example?: any;
|
|
158
|
+
encoding?: EncodingObject;
|
|
159
|
+
}
|
|
160
|
+
interface EncodingObject extends ISpecificationExtension {
|
|
161
|
+
[property: string]: EncodingPropertyObject | any;
|
|
162
|
+
}
|
|
163
|
+
interface EncodingPropertyObject {
|
|
164
|
+
contentType?: string;
|
|
165
|
+
headers?: {
|
|
166
|
+
[key: string]: HeaderObject | ReferenceObject;
|
|
167
|
+
};
|
|
168
|
+
style?: string;
|
|
169
|
+
explode?: boolean;
|
|
170
|
+
allowReserved?: boolean;
|
|
171
|
+
[key: string]: any;
|
|
172
|
+
}
|
|
173
|
+
interface ResponsesObject extends ISpecificationExtension {
|
|
174
|
+
default?: ResponseObject | ReferenceObject;
|
|
175
|
+
[statuscode: string]: ResponseObject | ReferenceObject | any;
|
|
176
|
+
}
|
|
177
|
+
interface ResponseObject extends ISpecificationExtension {
|
|
178
|
+
description: string;
|
|
179
|
+
headers?: HeadersObject;
|
|
180
|
+
content?: ContentObject;
|
|
181
|
+
links?: LinksObject;
|
|
182
|
+
}
|
|
183
|
+
interface CallbacksObject extends ISpecificationExtension {
|
|
184
|
+
[name: string]: CallbackObject | ReferenceObject | any;
|
|
185
|
+
}
|
|
186
|
+
interface CallbackObject extends ISpecificationExtension {
|
|
187
|
+
[name: string]: PathItemObject | any;
|
|
188
|
+
}
|
|
189
|
+
interface HeadersObject {
|
|
190
|
+
[name: string]: HeaderObject | ReferenceObject;
|
|
191
|
+
}
|
|
192
|
+
interface ExampleObject {
|
|
193
|
+
summary?: string;
|
|
194
|
+
description?: string;
|
|
195
|
+
value?: any;
|
|
196
|
+
externalValue?: string;
|
|
197
|
+
[property: string]: any;
|
|
198
|
+
}
|
|
199
|
+
interface LinksObject {
|
|
200
|
+
[name: string]: LinkObject | ReferenceObject;
|
|
201
|
+
}
|
|
202
|
+
interface LinkObject extends ISpecificationExtension {
|
|
203
|
+
operationRef?: string;
|
|
204
|
+
operationId?: string;
|
|
205
|
+
parameters?: LinkParametersObject;
|
|
206
|
+
requestBody?: any | string;
|
|
207
|
+
description?: string;
|
|
208
|
+
server?: ServerObject;
|
|
209
|
+
[property: string]: any;
|
|
210
|
+
}
|
|
211
|
+
interface LinkParametersObject {
|
|
212
|
+
[name: string]: any | string;
|
|
213
|
+
}
|
|
214
|
+
interface HeaderObject extends BaseParameterObject {
|
|
215
|
+
$ref?: string;
|
|
216
|
+
}
|
|
217
|
+
interface TagObject extends ISpecificationExtension {
|
|
218
|
+
name: string;
|
|
219
|
+
description?: string;
|
|
220
|
+
externalDocs?: ExternalDocumentationObject;
|
|
221
|
+
[extension: string]: any;
|
|
222
|
+
}
|
|
223
|
+
interface ExamplesObject {
|
|
224
|
+
[name: string]: ExampleObject | ReferenceObject;
|
|
225
|
+
}
|
|
226
|
+
interface ReferenceObject {
|
|
227
|
+
$ref: string;
|
|
228
|
+
summary?: string;
|
|
229
|
+
description?: string;
|
|
230
|
+
}
|
|
231
|
+
type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
|
|
232
|
+
interface SchemaObject extends ISpecificationExtension {
|
|
233
|
+
$ref?: string;
|
|
234
|
+
discriminator?: DiscriminatorObject;
|
|
235
|
+
readOnly?: boolean;
|
|
236
|
+
writeOnly?: boolean;
|
|
237
|
+
xml?: XmlObject;
|
|
238
|
+
externalDocs?: ExternalDocumentationObject;
|
|
239
|
+
example?: any;
|
|
240
|
+
examples?: any[];
|
|
241
|
+
deprecated?: boolean;
|
|
242
|
+
type?: SchemaObjectType | SchemaObjectType[];
|
|
243
|
+
format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
|
|
244
|
+
allOf?: (SchemaObject | ReferenceObject)[];
|
|
245
|
+
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
246
|
+
anyOf?: (SchemaObject | ReferenceObject)[];
|
|
247
|
+
not?: SchemaObject | ReferenceObject;
|
|
248
|
+
items?: SchemaObject | ReferenceObject;
|
|
249
|
+
properties?: {
|
|
250
|
+
[propertyName: string]: SchemaObject | ReferenceObject;
|
|
251
|
+
};
|
|
252
|
+
additionalProperties?: SchemaObject | ReferenceObject | boolean;
|
|
253
|
+
propertyNames?: SchemaObject | ReferenceObject;
|
|
254
|
+
description?: string;
|
|
255
|
+
default?: any;
|
|
256
|
+
title?: string;
|
|
257
|
+
multipleOf?: number;
|
|
258
|
+
maximum?: number;
|
|
259
|
+
const?: any;
|
|
260
|
+
exclusiveMaximum?: number;
|
|
261
|
+
minimum?: number;
|
|
262
|
+
exclusiveMinimum?: number;
|
|
263
|
+
maxLength?: number;
|
|
264
|
+
minLength?: number;
|
|
265
|
+
pattern?: string;
|
|
266
|
+
maxItems?: number;
|
|
267
|
+
minItems?: number;
|
|
268
|
+
uniqueItems?: boolean;
|
|
269
|
+
maxProperties?: number;
|
|
270
|
+
minProperties?: number;
|
|
271
|
+
required?: string[];
|
|
272
|
+
enum?: any[];
|
|
273
|
+
prefixItems?: (SchemaObject | ReferenceObject)[];
|
|
274
|
+
contentMediaType?: string;
|
|
275
|
+
contentEncoding?: string;
|
|
276
|
+
}
|
|
277
|
+
interface SchemasObject {
|
|
278
|
+
[schema: string]: SchemaObject;
|
|
279
|
+
}
|
|
280
|
+
interface DiscriminatorObject {
|
|
281
|
+
propertyName: string;
|
|
282
|
+
mapping?: {
|
|
283
|
+
[key: string]: string;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
interface XmlObject extends ISpecificationExtension {
|
|
287
|
+
name?: string;
|
|
288
|
+
namespace?: string;
|
|
289
|
+
prefix?: string;
|
|
290
|
+
attribute?: boolean;
|
|
291
|
+
wrapped?: boolean;
|
|
292
|
+
}
|
|
293
|
+
type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
294
|
+
interface SecuritySchemeObject extends ISpecificationExtension {
|
|
295
|
+
type: SecuritySchemeType;
|
|
296
|
+
description?: string;
|
|
297
|
+
name?: string;
|
|
298
|
+
in?: string;
|
|
299
|
+
scheme?: string;
|
|
300
|
+
bearerFormat?: string;
|
|
301
|
+
flows?: OAuthFlowsObject;
|
|
302
|
+
openIdConnectUrl?: string;
|
|
303
|
+
}
|
|
304
|
+
interface OAuthFlowsObject extends ISpecificationExtension {
|
|
305
|
+
implicit?: OAuthFlowObject;
|
|
306
|
+
password?: OAuthFlowObject;
|
|
307
|
+
clientCredentials?: OAuthFlowObject;
|
|
308
|
+
authorizationCode?: OAuthFlowObject;
|
|
309
|
+
}
|
|
310
|
+
interface OAuthFlowObject extends ISpecificationExtension {
|
|
311
|
+
authorizationUrl?: string;
|
|
312
|
+
tokenUrl?: string;
|
|
313
|
+
refreshUrl?: string;
|
|
314
|
+
scopes: ScopesObject;
|
|
315
|
+
}
|
|
316
|
+
interface ScopesObject extends ISpecificationExtension {
|
|
317
|
+
[scope: string]: any;
|
|
318
|
+
}
|
|
319
|
+
interface SecurityRequirementObject {
|
|
320
|
+
[name: string]: string[];
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/openapi.d.ts
|
|
324
|
+
declare const openApiVersions: readonly ["3.1.0", "3.1.1"];
|
|
325
|
+
type OpenApiVersion = (typeof openApiVersions)[number];
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/zod.d.ts
|
|
328
|
+
type Override = (ctx: {
|
|
329
|
+
zodSchema: core.$ZodTypes;
|
|
330
|
+
jsonSchema: core.JSONSchema.BaseSchema;
|
|
331
|
+
io: 'input' | 'output';
|
|
332
|
+
}) => void;
|
|
333
|
+
declare const isAnyZodType: (schema: unknown) => schema is core.$ZodTypes;
|
|
334
|
+
declare module 'zod/v4' {
|
|
335
|
+
interface GlobalMeta {
|
|
336
|
+
/**
|
|
337
|
+
* Used to set metadata for a parameter
|
|
338
|
+
*/
|
|
339
|
+
param?: Partial<ParameterObject> & {
|
|
340
|
+
/**
|
|
341
|
+
* Used to output this Zod Schema in the components parameters section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
342
|
+
*/
|
|
343
|
+
id?: string;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Used to set metadata for a response header
|
|
347
|
+
*/
|
|
348
|
+
header?: Partial<HeaderObject> & {
|
|
349
|
+
/**
|
|
350
|
+
* Used to output this Zod Schema in the components headers section. Any usage of this Zod Schema will then be transformed into a $ref.
|
|
351
|
+
*/
|
|
352
|
+
id?: string;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Use to override the rendered schema
|
|
356
|
+
*/
|
|
357
|
+
override?: SchemaObject | Override;
|
|
358
|
+
/**
|
|
359
|
+
* For use only if this Zod Schema is manually registered in the `components` section
|
|
360
|
+
* and is not used anywhere else in the document.
|
|
361
|
+
* Defaults to `output` if not specified.
|
|
362
|
+
*/
|
|
363
|
+
unusedIO?: 'input' | 'output';
|
|
364
|
+
/**
|
|
365
|
+
* An alternate id to use for this schema in the event the schema is used in both input and output contexts.
|
|
366
|
+
* If not specified, the id will be simply derived as the id of the schema plus an `Output` suffix. Please note that `id` must be set.
|
|
367
|
+
*/
|
|
368
|
+
outputId?: string;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/create/document.d.ts
|
|
373
|
+
interface ZodOpenApiMediaTypeObject extends Omit<MediaTypeObject, 'schema'> {
|
|
374
|
+
schema?: $ZodType | SchemaObject | ReferenceObject;
|
|
375
|
+
}
|
|
376
|
+
interface ZodOpenApiContentObject {
|
|
377
|
+
'application/json'?: ZodOpenApiMediaTypeObject;
|
|
378
|
+
[mediatype: string]: ZodOpenApiMediaTypeObject | undefined;
|
|
379
|
+
}
|
|
380
|
+
interface ZodOpenApiRequestBodyObject extends Omit<RequestBodyObject, 'content'> {
|
|
381
|
+
content: ZodOpenApiContentObject;
|
|
382
|
+
/** Use this field to auto register this request body as a component */
|
|
383
|
+
id?: string;
|
|
384
|
+
}
|
|
385
|
+
type ZodOpenApiHeadersObject = ZodObjectInput | HeadersObject;
|
|
386
|
+
interface ZodOpenApiResponseObject extends Omit<ResponseObject, 'content' | 'headers'> {
|
|
387
|
+
content?: ZodOpenApiContentObject;
|
|
388
|
+
headers?: ZodOpenApiHeadersObject;
|
|
389
|
+
/** Use this field to auto register this response object as a component */
|
|
390
|
+
id?: string;
|
|
391
|
+
}
|
|
392
|
+
interface ZodOpenApiResponsesObject extends ISpecificationExtension {
|
|
393
|
+
default?: ZodOpenApiResponseObject | ReferenceObject;
|
|
394
|
+
[statuscode: `${1 | 2 | 3 | 4 | 5}${string}`]: ZodOpenApiResponseObject | ReferenceObject;
|
|
395
|
+
}
|
|
396
|
+
type ZodOpenApiParameters = Partial<Record<ParameterLocation, ZodObjectInput>>;
|
|
397
|
+
interface ZodOpenApiCallbacksObject extends ISpecificationExtension {
|
|
398
|
+
[name: string]: ZodOpenApiCallbackObject;
|
|
399
|
+
}
|
|
400
|
+
interface ZodOpenApiCallbackObject extends ISpecificationExtension {
|
|
401
|
+
/** Use this field to auto register this callback object as a component */
|
|
402
|
+
id?: string;
|
|
403
|
+
[name: string]: ZodOpenApiPathItemObject | string | undefined;
|
|
404
|
+
}
|
|
405
|
+
interface ZodOpenApiOperationObject extends Omit<OperationObject, 'requestBody' | 'responses' | 'parameters' | 'callbacks'> {
|
|
406
|
+
parameters?: Array<$ZodType | ParameterObject | ReferenceObject>;
|
|
407
|
+
requestBody?: ZodOpenApiRequestBodyObject;
|
|
408
|
+
requestParams?: ZodOpenApiParameters;
|
|
409
|
+
responses: ZodOpenApiResponsesObject;
|
|
410
|
+
callbacks?: ZodOpenApiCallbacksObject;
|
|
411
|
+
}
|
|
412
|
+
interface ZodOpenApiPathItemObject extends Omit<PathItemObject, 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace'> {
|
|
413
|
+
get?: ZodOpenApiOperationObject;
|
|
414
|
+
put?: ZodOpenApiOperationObject;
|
|
415
|
+
post?: ZodOpenApiOperationObject;
|
|
416
|
+
delete?: ZodOpenApiOperationObject;
|
|
417
|
+
options?: ZodOpenApiOperationObject;
|
|
418
|
+
head?: ZodOpenApiOperationObject;
|
|
419
|
+
patch?: ZodOpenApiOperationObject;
|
|
420
|
+
trace?: ZodOpenApiOperationObject;
|
|
421
|
+
/**
|
|
422
|
+
* Used to register this path item as a component.
|
|
423
|
+
*/
|
|
424
|
+
id?: string;
|
|
425
|
+
}
|
|
426
|
+
interface ZodOpenApiPathsObject extends ISpecificationExtension {
|
|
427
|
+
[path: string]: ZodOpenApiPathItemObject;
|
|
428
|
+
}
|
|
429
|
+
type ZodOpenApiParameterObject = $ZodType | ParameterObject | ReferenceObject;
|
|
430
|
+
type ZodOpenApiHeaderObject = $ZodType | HeaderObject | ReferenceObject;
|
|
431
|
+
type ZodOpenApiSchemaObject = $ZodType | SchemaObject | ReferenceObject;
|
|
432
|
+
type ZodOpenApiRequestBody = $ZodType | RequestBodyObject | ReferenceObject;
|
|
433
|
+
interface ZodOpenApiComponentsObject extends Omit<ComponentsObject, 'schemas' | 'responses' | 'requestBodies' | 'headers' | 'parameters' | 'pathItems' | 'callbacks'> {
|
|
434
|
+
parameters?: Record<string, ZodOpenApiParameterObject>;
|
|
435
|
+
schemas?: Record<string, ZodOpenApiSchemaObject>;
|
|
436
|
+
requestBodies?: Record<string, ZodOpenApiRequestBodyObject>;
|
|
437
|
+
headers?: Record<string, ZodOpenApiHeaderObject>;
|
|
438
|
+
responses?: Record<string, ZodOpenApiResponseObject>;
|
|
439
|
+
callbacks?: Record<string, ZodOpenApiCallbackObject>;
|
|
440
|
+
pathItems?: Record<string, ZodOpenApiPathItemObject>;
|
|
441
|
+
}
|
|
442
|
+
type ZodOpenApiVersion = OpenApiVersion;
|
|
443
|
+
interface ZodOpenApiObject extends Omit<OpenAPIObject, 'openapi' | 'paths' | 'webhooks' | 'components'> {
|
|
444
|
+
openapi: ZodOpenApiVersion;
|
|
445
|
+
paths?: ZodOpenApiPathsObject;
|
|
446
|
+
webhooks?: ZodOpenApiPathsObject;
|
|
447
|
+
components?: ZodOpenApiComponentsObject;
|
|
448
|
+
}
|
|
449
|
+
type ZodObjectInputType<Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Record<string, unknown>> = ZodType<Output, Def, Input>;
|
|
450
|
+
type ZodObjectInput = $ZodType<unknown, Record<string, unknown>>;
|
|
451
|
+
type OverrideType = $ZodTypes['_zod']['def']['type'];
|
|
452
|
+
interface CreateDocumentOptions {
|
|
453
|
+
/**
|
|
454
|
+
* Use this to allowlist empty schemas to be created for given types
|
|
455
|
+
* - `true` — Allow empty schemas for input and output
|
|
456
|
+
* - `{ input: true, output: true }` — Allow empty schemas for input and output
|
|
457
|
+
* - `{ input: true }` — Allow empty schemas for input only
|
|
458
|
+
* - `{ output: true }` — Allow empty schemas for output only
|
|
459
|
+
*/
|
|
460
|
+
allowEmptySchema?: Partial<Record<OverrideType, true | Partial<{
|
|
461
|
+
input: true;
|
|
462
|
+
output: true;
|
|
463
|
+
}>>>;
|
|
464
|
+
/**
|
|
465
|
+
* Use to override the rendered schema
|
|
466
|
+
* - `{ type: 'string' }` — Override the schema type to be a string using an object
|
|
467
|
+
* - `(ctx) => { ctx.jsonSchema.type = 'string'; }` — Override the schema type to be a string using a function
|
|
468
|
+
*/
|
|
469
|
+
override?: Override;
|
|
470
|
+
/**
|
|
471
|
+
* How to handle reused schemas.
|
|
472
|
+
* - `"ref"` — Reused schemas will be rendered as references
|
|
473
|
+
* - `"inline"` — Default. Reused schemas will be inlined into the document
|
|
474
|
+
*/
|
|
475
|
+
reused?: 'ref' | 'inline';
|
|
476
|
+
/** How to handle cycles.
|
|
477
|
+
* - `"ref"` — Default. Cycles will be broken using $defs
|
|
478
|
+
* - `"throw"` — Cycles will throw an error if encountered */
|
|
479
|
+
cycles?: 'ref' | 'throw';
|
|
480
|
+
}
|
|
481
|
+
declare const createDocument: (zodOpenApiObject: ZodOpenApiObject, opts?: CreateDocumentOptions) => OpenAPIObject;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/create/components.d.ts
|
|
484
|
+
interface ComponentRegistry {
|
|
485
|
+
/**
|
|
486
|
+
* Contains a map of component name to their OpenAPI schema object or reference.
|
|
487
|
+
*/
|
|
488
|
+
schemas: {
|
|
489
|
+
dynamicSchemaCount: number;
|
|
490
|
+
input: Map<string, {
|
|
491
|
+
zodType: $ZodType;
|
|
492
|
+
schemaObject: SchemaObject | ReferenceObject;
|
|
493
|
+
}>;
|
|
494
|
+
output: Map<string, {
|
|
495
|
+
zodType: $ZodType;
|
|
496
|
+
schemaObject: SchemaObject | ReferenceObject;
|
|
497
|
+
}>;
|
|
498
|
+
ids: Map<string, SchemaObject | ReferenceObject>;
|
|
499
|
+
manual: Map<string, {
|
|
500
|
+
identifier: string;
|
|
501
|
+
io: {
|
|
502
|
+
input: {
|
|
503
|
+
used: number;
|
|
504
|
+
schemaObject: SchemaObject;
|
|
505
|
+
};
|
|
506
|
+
output: {
|
|
507
|
+
used: number;
|
|
508
|
+
schemaObject: SchemaObject;
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
zodType: $ZodType;
|
|
512
|
+
}>;
|
|
513
|
+
setSchema: (key: string, schema: $ZodType, io: 'input' | 'output') => SchemaObject | ReferenceObject;
|
|
514
|
+
};
|
|
515
|
+
headers: {
|
|
516
|
+
ids: Map<string, HeaderObject | ReferenceObject>;
|
|
517
|
+
seen: WeakMap<$ZodType, HeaderObject | ReferenceObject>;
|
|
518
|
+
};
|
|
519
|
+
requestBodies: {
|
|
520
|
+
ids: Map<string, RequestBodyObject | ReferenceObject>;
|
|
521
|
+
seen: WeakMap<ZodOpenApiRequestBodyObject, RequestBodyObject | ReferenceObject>;
|
|
522
|
+
};
|
|
523
|
+
responses: {
|
|
524
|
+
ids: Map<string, ResponseObject | ReferenceObject>;
|
|
525
|
+
seen: WeakMap<ZodOpenApiResponseObject, ResponseObject | ReferenceObject>;
|
|
526
|
+
};
|
|
527
|
+
parameters: {
|
|
528
|
+
ids: Map<string, ParameterObject | ReferenceObject>;
|
|
529
|
+
seen: WeakMap<$ZodType, ParameterObject | ReferenceObject>;
|
|
530
|
+
};
|
|
531
|
+
callbacks: {
|
|
532
|
+
ids: Map<string, ZodOpenApiCallbackObject | ReferenceObject>;
|
|
533
|
+
seen: WeakMap<ZodOpenApiCallbackObject, ZodOpenApiCallbackObject | ReferenceObject>;
|
|
534
|
+
};
|
|
535
|
+
pathItems: {
|
|
536
|
+
ids: Map<string, PathItemObject | ReferenceObject>;
|
|
537
|
+
seen: WeakMap<ZodOpenApiPathItemObject, PathItemObject | ReferenceObject>;
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
declare const createRegistry: (components?: ZodOpenApiComponentsObject) => ComponentRegistry;
|
|
541
|
+
declare const createComponents: (registry: ComponentRegistry, opts: CreateDocumentOptions) => ComponentsObject;
|
|
542
|
+
//#endregion
|
|
543
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodObjectInputType, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBody, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createComponents, createDocument, createRegistry, isAnyZodType };
|