zod-openapi 5.0.0-beta.9 → 5.0.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.
- package/README.md +185 -47
- package/dist/api.d.mts +2 -11
- package/dist/api.d.ts +2 -11
- package/dist/api.js +1 -2
- package/dist/api.mjs +2 -2
- package/dist/components-BRLB21IO.js +958 -0
- package/dist/components-DuIz-WUQ.mjs +900 -0
- package/dist/{components-26wns3Hd.d.mts → components-Dus8apcN.d.mts} +183 -91
- package/dist/{components-CokUEQbL.d.ts → components-T2U31sZh.d.ts} +183 -91
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +6 -4
- package/dist/components-0QHfGwg0.mjs +0 -791
- package/dist/components-CB3cj8u3.js +0 -855
|
@@ -1,855 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
const zod_v4_core = __toESM(require("zod/v4/core"));
|
|
25
|
-
const zod_v4 = __toESM(require("zod/v4"));
|
|
26
|
-
|
|
27
|
-
//#region src/zod.ts
|
|
28
|
-
const isAnyZodType = (schema) => typeof schema === "object" && schema !== null && "_zod" in schema;
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/create/object.ts
|
|
32
|
-
const unwrapZodObject = (zodType, io, path) => {
|
|
33
|
-
const def = zodType._zod.def;
|
|
34
|
-
switch (def.type) {
|
|
35
|
-
case "object": return zodType;
|
|
36
|
-
case "lazy": return unwrapZodObject(def.getter(), io, path);
|
|
37
|
-
case "pipe": {
|
|
38
|
-
if (io === "input") return unwrapZodObject(def.in, io, path);
|
|
39
|
-
return unwrapZodObject(def.out, io, path);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new Error(`Failed to unwrap ZodObject from type: ${zodType._zod.def.type} at ${path.join(" > ")}`);
|
|
43
|
-
};
|
|
44
|
-
const isRequired = (zodType, io) => {
|
|
45
|
-
if (io === "input") return zodType._zod.optin === void 0;
|
|
46
|
-
return zodType._zod.optout === void 0;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/create/parameters.ts
|
|
51
|
-
const createParameter = (parameter, location, ctx, path) => {
|
|
52
|
-
const seenParameter = ctx.registry.parameters.seen.get(parameter);
|
|
53
|
-
if (seenParameter) return seenParameter;
|
|
54
|
-
const meta = zod_v4.globalRegistry.get(parameter);
|
|
55
|
-
const name = location?.name ?? meta?.param?.name;
|
|
56
|
-
const inLocation = location?.in ?? meta?.param?.in;
|
|
57
|
-
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
58
|
-
const computedPath = [
|
|
59
|
-
...path,
|
|
60
|
-
inLocation,
|
|
61
|
-
name
|
|
62
|
-
].join(" > ");
|
|
63
|
-
const schemaObject = ctx.registry.schemas.setSchema(computedPath, parameter, ctx.io);
|
|
64
|
-
const { id,...rest } = meta?.param ?? {};
|
|
65
|
-
const parameterObject = {
|
|
66
|
-
...rest,
|
|
67
|
-
name,
|
|
68
|
-
in: inLocation,
|
|
69
|
-
schema: schemaObject
|
|
70
|
-
};
|
|
71
|
-
if (isRequired(parameter, ctx.io)) parameterObject.required = true;
|
|
72
|
-
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
73
|
-
if (id) {
|
|
74
|
-
const ref = { $ref: `#/components/parameters/${id}` };
|
|
75
|
-
ctx.registry.parameters.seen.set(parameter, ref);
|
|
76
|
-
ctx.registry.parameters.ids.set(id, parameterObject);
|
|
77
|
-
return ref;
|
|
78
|
-
}
|
|
79
|
-
ctx.registry.parameters.seen.set(parameter, parameterObject);
|
|
80
|
-
return parameterObject;
|
|
81
|
-
};
|
|
82
|
-
const createManualParameters = (parameters, ctx, path) => {
|
|
83
|
-
if (!parameters) return void 0;
|
|
84
|
-
const parameterObjects = [];
|
|
85
|
-
for (const parameter of parameters) {
|
|
86
|
-
if (isAnyZodType(parameter)) {
|
|
87
|
-
const seenParameter = ctx.registry.parameters.seen.get(parameter);
|
|
88
|
-
if (seenParameter) {
|
|
89
|
-
parameterObjects.push(seenParameter);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const paramObject = createParameter(parameter, void 0, ctx, [...path, "parameters"]);
|
|
93
|
-
parameterObjects.push(paramObject);
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
parameterObjects.push(parameter);
|
|
97
|
-
}
|
|
98
|
-
return parameterObjects;
|
|
99
|
-
};
|
|
100
|
-
const createParameters = (requestParams, ctx, path) => {
|
|
101
|
-
if (!requestParams) return void 0;
|
|
102
|
-
const parameterObjects = [];
|
|
103
|
-
for (const [location, schema] of Object.entries(requestParams ?? {})) {
|
|
104
|
-
if (!schema) continue;
|
|
105
|
-
const zodObject = unwrapZodObject(schema, ctx.io, path);
|
|
106
|
-
for (const [name, zodSchema] of Object.entries(zodObject._zod.def.shape)) {
|
|
107
|
-
const seenParameter = ctx.registry.parameters.seen.get(zodSchema);
|
|
108
|
-
if (seenParameter) {
|
|
109
|
-
parameterObjects.push(seenParameter);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
const paramObject = createParameter(zodSchema, {
|
|
113
|
-
in: location,
|
|
114
|
-
name
|
|
115
|
-
}, ctx, [
|
|
116
|
-
...path,
|
|
117
|
-
location,
|
|
118
|
-
name
|
|
119
|
-
]);
|
|
120
|
-
parameterObjects.push(paramObject);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return parameterObjects;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region src/create/content.ts
|
|
128
|
-
const createMediaTypeObject = (mediaTypeObject, ctx, path) => {
|
|
129
|
-
const computedPath = path.join(" > ");
|
|
130
|
-
if (isAnyZodType(mediaTypeObject.schema)) {
|
|
131
|
-
const schemaObject = ctx.registry.schemas.setSchema(computedPath, mediaTypeObject.schema, ctx.io);
|
|
132
|
-
return {
|
|
133
|
-
...mediaTypeObject,
|
|
134
|
-
schema: schemaObject
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
return mediaTypeObject;
|
|
138
|
-
};
|
|
139
|
-
const createContent = (content, ctx, path) => {
|
|
140
|
-
const contentObject = {};
|
|
141
|
-
for (const [mediaType, mediaTypeObject] of Object.entries(content)) if (mediaTypeObject) contentObject[mediaType] = createMediaTypeObject(mediaTypeObject, ctx, [...path, mediaType]);
|
|
142
|
-
return contentObject;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
//#endregion
|
|
146
|
-
//#region src/create/requestBody.ts
|
|
147
|
-
const createRequestBody = (requestBody, ctx, path) => {
|
|
148
|
-
if (!requestBody) return void 0;
|
|
149
|
-
const seenRequestBody = ctx.registry.requestBodies.seen.get(requestBody);
|
|
150
|
-
if (seenRequestBody) return seenRequestBody;
|
|
151
|
-
const { content, id,...rest } = requestBody;
|
|
152
|
-
const requestBodyObject = {
|
|
153
|
-
...rest,
|
|
154
|
-
content: createContent(content, ctx, [...path, "content"])
|
|
155
|
-
};
|
|
156
|
-
if (id) {
|
|
157
|
-
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
158
|
-
ctx.registry.requestBodies.ids.set(id, requestBodyObject);
|
|
159
|
-
ctx.registry.requestBodies.seen.set(requestBody, ref);
|
|
160
|
-
return ref;
|
|
161
|
-
}
|
|
162
|
-
ctx.registry.requestBodies.seen.set(requestBody, requestBodyObject);
|
|
163
|
-
return requestBodyObject;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/create/headers.ts
|
|
168
|
-
const createHeader = (header, ctx, path) => {
|
|
169
|
-
const seenHeader = ctx.registry.headers.seen.get(header);
|
|
170
|
-
if (seenHeader) return seenHeader;
|
|
171
|
-
const meta = zod_v4.globalRegistry.get(header);
|
|
172
|
-
const { id,...rest } = meta?.header ?? {};
|
|
173
|
-
const headerObject = rest;
|
|
174
|
-
if (isRequired(header, ctx.io)) headerObject.required = true;
|
|
175
|
-
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
176
|
-
const computedPath = path.join(" > ");
|
|
177
|
-
headerObject.schema = ctx.registry.schemas.setSchema(computedPath, header, ctx.io);
|
|
178
|
-
if (id) {
|
|
179
|
-
const ref = { $ref: `#/components/headers/${id}` };
|
|
180
|
-
ctx.registry.headers.ids.set(id, headerObject);
|
|
181
|
-
ctx.registry.headers.seen.set(header, ref);
|
|
182
|
-
return ref;
|
|
183
|
-
}
|
|
184
|
-
ctx.registry.headers.seen.set(header, headerObject);
|
|
185
|
-
return headerObject;
|
|
186
|
-
};
|
|
187
|
-
const createHeaders = (headers, ctx, path) => {
|
|
188
|
-
if (!headers) return void 0;
|
|
189
|
-
if (isAnyZodType(headers)) {
|
|
190
|
-
const zodObject = unwrapZodObject(headers, ctx.io, path);
|
|
191
|
-
const headersObject = {};
|
|
192
|
-
for (const [key, zodSchema] of Object.entries(zodObject._zod.def.shape)) {
|
|
193
|
-
const header = createHeader(zodSchema, ctx, [...path, key]);
|
|
194
|
-
headersObject[key] = header;
|
|
195
|
-
}
|
|
196
|
-
return headersObject;
|
|
197
|
-
}
|
|
198
|
-
return headers;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/create/specificationExtension.ts
|
|
203
|
-
const isISpecificationExtension = (key) => key.startsWith("x-");
|
|
204
|
-
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/create/responses.ts
|
|
207
|
-
const createResponse = (response, ctx, path) => {
|
|
208
|
-
const seenResponse = ctx.registry.responses.seen.get(response);
|
|
209
|
-
if (seenResponse) return seenResponse;
|
|
210
|
-
const { content, headers, id,...rest } = response;
|
|
211
|
-
const responseObject = rest;
|
|
212
|
-
const maybeHeaders = createHeaders(headers, ctx, [...path, "headers"]);
|
|
213
|
-
if (maybeHeaders) responseObject.headers = maybeHeaders;
|
|
214
|
-
if (content) responseObject.content = createContent(content, ctx, [...path, "content"]);
|
|
215
|
-
if (id) {
|
|
216
|
-
const ref = { $ref: `#/components/responses/${id}` };
|
|
217
|
-
ctx.registry.responses.ids.set(id, responseObject);
|
|
218
|
-
ctx.registry.responses.seen.set(response, ref);
|
|
219
|
-
return ref;
|
|
220
|
-
}
|
|
221
|
-
ctx.registry.responses.seen.set(response, responseObject);
|
|
222
|
-
return responseObject;
|
|
223
|
-
};
|
|
224
|
-
const createResponses = (responses, ctx, path) => {
|
|
225
|
-
if (!responses) return void 0;
|
|
226
|
-
const responsesObject = {};
|
|
227
|
-
for (const [statusCode, response] of Object.entries(responses)) {
|
|
228
|
-
if (!response) continue;
|
|
229
|
-
if (isISpecificationExtension(statusCode)) {
|
|
230
|
-
responsesObject[statusCode] = response;
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
if ("$ref" in response) {
|
|
234
|
-
responsesObject[statusCode] = response;
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
const responseObject = createResponse(response, ctx, [...path, statusCode]);
|
|
238
|
-
responsesObject[statusCode] = responseObject;
|
|
239
|
-
}
|
|
240
|
-
return responsesObject;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
//#endregion
|
|
244
|
-
//#region src/create/paths.ts
|
|
245
|
-
const createOperation = (operationObject, registry$1, path) => {
|
|
246
|
-
const { parameters, requestParams, requestBody, responses, callbacks,...rest } = operationObject;
|
|
247
|
-
const operation = rest;
|
|
248
|
-
const maybeManualParameters = createManualParameters(parameters, {
|
|
249
|
-
registry: registry$1,
|
|
250
|
-
io: "input"
|
|
251
|
-
}, [...path, "parameters"]);
|
|
252
|
-
const maybeRequestParams = createParameters(requestParams, {
|
|
253
|
-
registry: registry$1,
|
|
254
|
-
io: "input"
|
|
255
|
-
}, [...path, "requestParams"]);
|
|
256
|
-
if (maybeRequestParams || maybeManualParameters) operation.parameters = [...maybeRequestParams ?? [], ...maybeManualParameters ?? []];
|
|
257
|
-
const maybeRequestBody = createRequestBody(requestBody, {
|
|
258
|
-
registry: registry$1,
|
|
259
|
-
io: "input"
|
|
260
|
-
}, [...path, "requestBody"]);
|
|
261
|
-
if (maybeRequestBody) operation.requestBody = maybeRequestBody;
|
|
262
|
-
const maybeResponses = createResponses(responses, {
|
|
263
|
-
registry: registry$1,
|
|
264
|
-
io: "output"
|
|
265
|
-
}, [...path, "responses"]);
|
|
266
|
-
if (maybeResponses) operation.responses = maybeResponses;
|
|
267
|
-
const maybeCallbacks = createCallbacks(callbacks, registry$1, [...path, "callbacks"]);
|
|
268
|
-
if (maybeCallbacks) operation.callbacks = maybeCallbacks;
|
|
269
|
-
return operation;
|
|
270
|
-
};
|
|
271
|
-
const createPathItem = (pathItem, registry$1, path) => {
|
|
272
|
-
const pathItemObject = {};
|
|
273
|
-
const { id,...rest } = pathItem;
|
|
274
|
-
for (const [key, value] of Object.entries(rest)) {
|
|
275
|
-
if (key === "get" || key === "put" || key === "post" || key === "delete" || key === "options" || key === "head" || key === "patch" || key === "trace") {
|
|
276
|
-
pathItemObject[key] = createOperation(value, registry$1, [...path, key]);
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
if (key === "parameters") {
|
|
280
|
-
pathItemObject[key] = createManualParameters(value, {
|
|
281
|
-
registry: registry$1,
|
|
282
|
-
io: "input"
|
|
283
|
-
}, [...path, key]);
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
pathItemObject[key] = value;
|
|
287
|
-
}
|
|
288
|
-
if (id) {
|
|
289
|
-
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
290
|
-
registry$1.pathItems.ids.set(id, pathItemObject);
|
|
291
|
-
registry$1.pathItems.seen.set(pathItem, ref);
|
|
292
|
-
return ref;
|
|
293
|
-
}
|
|
294
|
-
registry$1.pathItems.seen.set(pathItem, pathItemObject);
|
|
295
|
-
return pathItemObject;
|
|
296
|
-
};
|
|
297
|
-
const createPaths = (paths, registry$1, path) => {
|
|
298
|
-
if (!paths) return void 0;
|
|
299
|
-
const pathsObject = {};
|
|
300
|
-
for (const [singlePath, pathItemObject] of Object.entries(paths)) {
|
|
301
|
-
if (isISpecificationExtension(singlePath)) {
|
|
302
|
-
pathsObject[singlePath] = pathItemObject;
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
pathsObject[singlePath] = createPathItem(pathItemObject, registry$1, [...path, singlePath]);
|
|
306
|
-
}
|
|
307
|
-
return pathsObject;
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/create/callbacks.ts
|
|
312
|
-
const createCallback = (callbackObject, registry$1, path) => {
|
|
313
|
-
const seenCallback = registry$1.callbacks.seen.get(callbackObject);
|
|
314
|
-
if (seenCallback) return seenCallback;
|
|
315
|
-
const { id,...rest } = callbackObject;
|
|
316
|
-
const callback = {};
|
|
317
|
-
for (const [name, pathItem] of Object.entries(rest)) {
|
|
318
|
-
if (isISpecificationExtension(name)) {
|
|
319
|
-
callback[name] = pathItem;
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
callback[name] = createPathItem(pathItem, registry$1, [...path, name]);
|
|
323
|
-
}
|
|
324
|
-
if (id) {
|
|
325
|
-
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
326
|
-
registry$1.callbacks.ids.set(id, callback);
|
|
327
|
-
registry$1.callbacks.seen.set(callbackObject, ref);
|
|
328
|
-
return ref;
|
|
329
|
-
}
|
|
330
|
-
registry$1.callbacks.seen.set(callbackObject, callback);
|
|
331
|
-
return callback;
|
|
332
|
-
};
|
|
333
|
-
const createCallbacks = (callbacks, registry$1, path) => {
|
|
334
|
-
if (!callbacks) return void 0;
|
|
335
|
-
const callbacksObject = {};
|
|
336
|
-
for (const [name, value] of Object.entries(callbacks)) {
|
|
337
|
-
if (isISpecificationExtension(name)) {
|
|
338
|
-
callbacksObject[name] = value;
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
callbacksObject[name] = createCallback(value, registry$1, [...path, name]);
|
|
342
|
-
}
|
|
343
|
-
return callbacksObject;
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
//#endregion
|
|
347
|
-
//#region src/create/schema/override.ts
|
|
348
|
-
const override = (ctx) => {
|
|
349
|
-
const def = ctx.zodSchema._zod.def;
|
|
350
|
-
switch (def.type) {
|
|
351
|
-
case "bigint": {
|
|
352
|
-
ctx.jsonSchema.type = "integer";
|
|
353
|
-
ctx.jsonSchema.format = "int64";
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
case "union": {
|
|
357
|
-
if ("discriminator" in def && typeof def.discriminator === "string") {
|
|
358
|
-
ctx.jsonSchema.oneOf = ctx.jsonSchema.anyOf;
|
|
359
|
-
delete ctx.jsonSchema.anyOf;
|
|
360
|
-
ctx.jsonSchema.type = "object";
|
|
361
|
-
ctx.jsonSchema.discriminator = { propertyName: def.discriminator };
|
|
362
|
-
const mapping = {};
|
|
363
|
-
for (const [index, obj] of Object.entries(ctx.jsonSchema.oneOf)) {
|
|
364
|
-
const ref = obj.$ref;
|
|
365
|
-
if (!ref) return;
|
|
366
|
-
const discriminatorValues = def.options[Number(index)]._zod.propValues?.[def.discriminator];
|
|
367
|
-
if (!discriminatorValues?.size) return;
|
|
368
|
-
for (const value of [...discriminatorValues ?? []]) {
|
|
369
|
-
if (typeof value !== "string") return;
|
|
370
|
-
mapping[value] = ref;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
ctx.jsonSchema.discriminator.mapping = mapping;
|
|
374
|
-
}
|
|
375
|
-
const meta = ctx.zodSchema.meta();
|
|
376
|
-
if (typeof meta?.unionOneOf === "boolean") {
|
|
377
|
-
if (meta.unionOneOf) {
|
|
378
|
-
ctx.jsonSchema.oneOf = ctx.jsonSchema.anyOf;
|
|
379
|
-
delete ctx.jsonSchema.anyOf;
|
|
380
|
-
}
|
|
381
|
-
delete ctx.jsonSchema.unionOneOf;
|
|
382
|
-
}
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
case "date": {
|
|
386
|
-
ctx.jsonSchema.type = "string";
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
case "literal": {
|
|
390
|
-
if (def.values.includes(void 0)) break;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
const validate = (ctx, opts) => {
|
|
396
|
-
if (Object.keys(ctx.jsonSchema).length) return;
|
|
397
|
-
const def = ctx.zodSchema._zod.def;
|
|
398
|
-
const allowEmptySchema = opts.allowEmptySchema?.[def.type];
|
|
399
|
-
if (allowEmptySchema === true || allowEmptySchema?.[ctx.io]) return;
|
|
400
|
-
switch (def.type) {
|
|
401
|
-
case "any": return;
|
|
402
|
-
case "unknown": return;
|
|
403
|
-
case "pipe": {
|
|
404
|
-
if (ctx.io === "output") throw new Error("Zod transform schemas are not supported in output schemas. Please use `.overwrite()` or wrap the schema in a `.pipe()`");
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
case "transform": {
|
|
408
|
-
if (ctx.io === "output") return;
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
case "literal": {
|
|
412
|
-
if (def.values.includes(void 0)) throw new Error("Zod literal schemas cannot include `undefined` as a value. Please use `z.undefined()` or `.optional()` instead.");
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
throw new Error(`Zod schema of type \`${def.type}\` cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``);
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
//#endregion
|
|
420
|
-
//#region src/create/schema/rename.ts
|
|
421
|
-
const renameComponents = (components, outputIds, ctx) => {
|
|
422
|
-
const componentsToRename = /* @__PURE__ */ new Map();
|
|
423
|
-
if (ctx.io === "input") return componentsToRename;
|
|
424
|
-
const componentDependencies = /* @__PURE__ */ new Map();
|
|
425
|
-
const stringifiedComponents = /* @__PURE__ */ new Map();
|
|
426
|
-
for (const [key, value] of Object.entries(components)) {
|
|
427
|
-
const stringified = JSON.stringify(value);
|
|
428
|
-
const matches = stringified.matchAll(/"#\/components\/schemas\/([^"]+)"/g);
|
|
429
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
430
|
-
for (const match of matches) {
|
|
431
|
-
const dep = match[1];
|
|
432
|
-
if (dep !== key) dependencies.add(dep);
|
|
433
|
-
}
|
|
434
|
-
stringifiedComponents.set(key, stringified);
|
|
435
|
-
componentDependencies.set(key, { dependencies });
|
|
436
|
-
}
|
|
437
|
-
for (const [key] of stringifiedComponents) {
|
|
438
|
-
const registeredComponent = ctx.registry.schemas.ids.get(key);
|
|
439
|
-
if (!registeredComponent) continue;
|
|
440
|
-
if (isDependencyPure(componentDependencies, stringifiedComponents, ctx.registry, key)) continue;
|
|
441
|
-
const newName = outputIds.get(key) ?? `${key}Output`;
|
|
442
|
-
componentsToRename.set(key, newName);
|
|
443
|
-
components[newName] = components[key];
|
|
444
|
-
delete components[key];
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
return componentsToRename;
|
|
448
|
-
};
|
|
449
|
-
const isDependencyPure = (componentDependencies, stringifiedComponents, registry$1, key, visited = /* @__PURE__ */ new Set()) => {
|
|
450
|
-
if (visited.has(key)) return true;
|
|
451
|
-
const dependencies = componentDependencies.get(key);
|
|
452
|
-
if (dependencies.pure !== void 0) return dependencies.pure;
|
|
453
|
-
const stringified = stringifiedComponents.get(key);
|
|
454
|
-
const component = registry$1.schemas.ids.get(key);
|
|
455
|
-
if (component && stringified !== JSON.stringify(component)) {
|
|
456
|
-
dependencies.pure = false;
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
visited.add(key);
|
|
460
|
-
const result = [...dependencies.dependencies].every((dep) => isDependencyPure(componentDependencies, stringifiedComponents, registry$1, dep, new Set(visited)));
|
|
461
|
-
dependencies.pure = result;
|
|
462
|
-
return result;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region src/create/schema/schema.ts
|
|
467
|
-
const deleteZodOpenApiMeta = (jsonSchema) => {
|
|
468
|
-
delete jsonSchema.param;
|
|
469
|
-
delete jsonSchema.header;
|
|
470
|
-
delete jsonSchema.unusedIO;
|
|
471
|
-
delete jsonSchema.override;
|
|
472
|
-
delete jsonSchema.outputId;
|
|
473
|
-
};
|
|
474
|
-
const createSchema = (schema, ctx = {
|
|
475
|
-
registry: createRegistry(),
|
|
476
|
-
io: "output",
|
|
477
|
-
opts: {}
|
|
478
|
-
}) => {
|
|
479
|
-
ctx.registry ??= createRegistry();
|
|
480
|
-
ctx.opts ??= {};
|
|
481
|
-
ctx.io ??= "output";
|
|
482
|
-
const registrySchemas = Object.fromEntries(ctx.registry.schemas[ctx.io]);
|
|
483
|
-
const schemas = { zodOpenApiCreateSchema: { zodType: schema } };
|
|
484
|
-
Object.assign(schemas, registrySchemas);
|
|
485
|
-
const jsonSchemas = createSchemas(schemas, {
|
|
486
|
-
registry: ctx.registry,
|
|
487
|
-
io: ctx.io,
|
|
488
|
-
opts: ctx.opts
|
|
489
|
-
});
|
|
490
|
-
return {
|
|
491
|
-
schema: jsonSchemas.schemas.zodOpenApiCreateSchema,
|
|
492
|
-
components: jsonSchemas.components
|
|
493
|
-
};
|
|
494
|
-
};
|
|
495
|
-
const createSchemas = (schemas, ctx) => {
|
|
496
|
-
const entries = {};
|
|
497
|
-
for (const [name, { zodType }] of Object.entries(schemas)) entries[name] = zodType;
|
|
498
|
-
const zodRegistry = (0, zod_v4.registry)();
|
|
499
|
-
zodRegistry.add((0, zod_v4.object)(entries), { id: "zodOpenApiCreateSchema" });
|
|
500
|
-
for (const [id, { zodType }] of ctx.registry.schemas.manual) zodRegistry.add(zodType, { id });
|
|
501
|
-
const outputIds = /* @__PURE__ */ new Map();
|
|
502
|
-
const jsonSchema = (0, zod_v4.toJSONSchema)(zodRegistry, {
|
|
503
|
-
override(context) {
|
|
504
|
-
const meta = context.zodSchema.meta();
|
|
505
|
-
if (meta?.outputId && meta?.id) outputIds.set(meta.id, meta.outputId);
|
|
506
|
-
if (context.jsonSchema.$ref) return;
|
|
507
|
-
const enrichedContext = {
|
|
508
|
-
...context,
|
|
509
|
-
io: ctx.io
|
|
510
|
-
};
|
|
511
|
-
override(enrichedContext);
|
|
512
|
-
if (typeof ctx.opts.override === "function") ctx.opts.override(enrichedContext);
|
|
513
|
-
if (typeof meta?.override === "function") {
|
|
514
|
-
meta.override(enrichedContext);
|
|
515
|
-
delete context.jsonSchema.override;
|
|
516
|
-
}
|
|
517
|
-
if (typeof meta?.override === "object" && meta.override !== null) {
|
|
518
|
-
Object.assign(context.jsonSchema, meta.override);
|
|
519
|
-
delete context.jsonSchema.override;
|
|
520
|
-
}
|
|
521
|
-
delete context.jsonSchema.$schema;
|
|
522
|
-
delete context.jsonSchema.id;
|
|
523
|
-
deleteZodOpenApiMeta(context.jsonSchema);
|
|
524
|
-
validate(enrichedContext, ctx.opts);
|
|
525
|
-
},
|
|
526
|
-
io: ctx.io,
|
|
527
|
-
unrepresentable: "any",
|
|
528
|
-
reused: ctx.opts.reused,
|
|
529
|
-
cycles: ctx.opts.cycles,
|
|
530
|
-
uri: (id) => id === "__shared" ? `#ZOD_OPENAPI/${id}` : `#ZOD_OPENAPI/__shared#/$defs/${id}`
|
|
531
|
-
});
|
|
532
|
-
const components = jsonSchema.schemas.__shared?.$defs ?? {};
|
|
533
|
-
jsonSchema.schemas.__shared ??= { $defs: components };
|
|
534
|
-
const dynamicComponents = /* @__PURE__ */ new Map();
|
|
535
|
-
for (const [key, value] of Object.entries(components)) if (/^schema\d+$/.test(key)) {
|
|
536
|
-
const newName = `__schema${ctx.registry.schemas.dynamicSchemaCount++}`;
|
|
537
|
-
dynamicComponents.set(key, `"#/components/schemas/${newName}"`);
|
|
538
|
-
if (newName !== key) {
|
|
539
|
-
components[newName] = value;
|
|
540
|
-
delete components[key];
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
const manualUsed = {};
|
|
544
|
-
const parsedJsonSchema = JSON.parse(JSON.stringify(jsonSchema).replace(/"#ZOD_OPENAPI\/__shared#\/\$defs\/([^"]+)"/g, (_, match) => {
|
|
545
|
-
const dynamic = dynamicComponents.get(match);
|
|
546
|
-
if (dynamic) return dynamic;
|
|
547
|
-
const manualComponent = ctx.registry.schemas.manual.get(match);
|
|
548
|
-
if (manualComponent) manualUsed[match] = true;
|
|
549
|
-
return `"#/components/schemas/${match}"`;
|
|
550
|
-
}));
|
|
551
|
-
const parsedComponents = parsedJsonSchema.schemas.__shared?.$defs ?? {};
|
|
552
|
-
parsedJsonSchema.schemas.__shared ??= { $defs: parsedComponents };
|
|
553
|
-
for (const [key] of ctx.registry.schemas.manual) {
|
|
554
|
-
const manualComponent = parsedJsonSchema.schemas[key];
|
|
555
|
-
if (!manualComponent) continue;
|
|
556
|
-
delete manualComponent.$schema;
|
|
557
|
-
delete manualComponent.id;
|
|
558
|
-
if (manualUsed[key]) {
|
|
559
|
-
delete manualComponent.$schema;
|
|
560
|
-
delete manualComponent.id;
|
|
561
|
-
if (parsedComponents[key]) throw new Error(`Component "${key}" is already registered as a component in the registry`);
|
|
562
|
-
parsedComponents[key] = manualComponent;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
const componentsToRename = renameComponents(parsedComponents, outputIds, ctx);
|
|
566
|
-
if (!componentsToRename.size) {
|
|
567
|
-
const parsedSchemas = parsedJsonSchema.schemas.zodOpenApiCreateSchema?.properties;
|
|
568
|
-
delete parsedJsonSchema.schemas.zodOpenApiCreateSchema;
|
|
569
|
-
delete parsedJsonSchema.schemas.__shared;
|
|
570
|
-
return {
|
|
571
|
-
schemas: parsedSchemas,
|
|
572
|
-
components: parsedComponents,
|
|
573
|
-
manual: parsedJsonSchema.schemas
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
const renamedJsonSchema = JSON.parse(JSON.stringify(parsedJsonSchema).replace(/"#\/components\/schemas\/([^"]+)"/g, (_, match) => {
|
|
577
|
-
const replacement = componentsToRename.get(match);
|
|
578
|
-
if (replacement) return `"#/components/schemas/${replacement}"`;
|
|
579
|
-
return `"#/components/schemas/${match}"`;
|
|
580
|
-
}));
|
|
581
|
-
const renamedSchemas = renamedJsonSchema.schemas.zodOpenApiCreateSchema?.properties;
|
|
582
|
-
const renamedComponents = renamedJsonSchema.schemas.__shared?.$defs ?? {};
|
|
583
|
-
delete renamedJsonSchema.schemas.zodOpenApiCreateSchema;
|
|
584
|
-
delete renamedJsonSchema.schemas.__shared;
|
|
585
|
-
return {
|
|
586
|
-
schemas: renamedSchemas,
|
|
587
|
-
components: renamedComponents,
|
|
588
|
-
manual: renamedJsonSchema.schemas
|
|
589
|
-
};
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region src/create/components.ts
|
|
594
|
-
const createRegistry = (components) => {
|
|
595
|
-
const registry$1 = {
|
|
596
|
-
schemas: {
|
|
597
|
-
dynamicSchemaCount: 0,
|
|
598
|
-
input: /* @__PURE__ */ new Map(),
|
|
599
|
-
output: /* @__PURE__ */ new Map(),
|
|
600
|
-
ids: /* @__PURE__ */ new Map(),
|
|
601
|
-
manual: /* @__PURE__ */ new Map(),
|
|
602
|
-
setSchema: (key, schema, io) => {
|
|
603
|
-
const schemaObject = {};
|
|
604
|
-
registry$1.schemas[io].set(key, {
|
|
605
|
-
schemaObject,
|
|
606
|
-
zodType: schema
|
|
607
|
-
});
|
|
608
|
-
return schemaObject;
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
headers: {
|
|
612
|
-
ids: /* @__PURE__ */ new Map(),
|
|
613
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
614
|
-
},
|
|
615
|
-
requestBodies: {
|
|
616
|
-
ids: /* @__PURE__ */ new Map(),
|
|
617
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
618
|
-
},
|
|
619
|
-
responses: {
|
|
620
|
-
ids: /* @__PURE__ */ new Map(),
|
|
621
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
622
|
-
},
|
|
623
|
-
parameters: {
|
|
624
|
-
ids: /* @__PURE__ */ new Map(),
|
|
625
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
626
|
-
},
|
|
627
|
-
callbacks: {
|
|
628
|
-
ids: /* @__PURE__ */ new Map(),
|
|
629
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
630
|
-
},
|
|
631
|
-
pathItems: {
|
|
632
|
-
ids: /* @__PURE__ */ new Map(),
|
|
633
|
-
seen: /* @__PURE__ */ new WeakMap()
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
registerSchemas(components?.schemas, registry$1);
|
|
637
|
-
registerParameters(components?.parameters, registry$1);
|
|
638
|
-
registerHeaders(components?.headers, registry$1);
|
|
639
|
-
registerResponses(components?.responses, registry$1);
|
|
640
|
-
registerPathItems(components?.pathItems, registry$1);
|
|
641
|
-
registerRequestBodies(components?.requestBodies, registry$1);
|
|
642
|
-
registerCallbacks(components?.callbacks, registry$1);
|
|
643
|
-
return registry$1;
|
|
644
|
-
};
|
|
645
|
-
const registerSchemas = (schemas, registry$1) => {
|
|
646
|
-
if (!schemas) return;
|
|
647
|
-
for (const [key, schema] of Object.entries(schemas)) {
|
|
648
|
-
if (registry$1.schemas.ids.has(key)) throw new Error(`Schema "${key}" is already registered`);
|
|
649
|
-
if (isAnyZodType(schema)) {
|
|
650
|
-
const id = zod_v4_core.globalRegistry.get(schema)?.id ?? key;
|
|
651
|
-
registry$1.schemas.manual.set(id, {
|
|
652
|
-
input: { schemaObject: {} },
|
|
653
|
-
output: { schemaObject: {} },
|
|
654
|
-
zodType: schema
|
|
655
|
-
});
|
|
656
|
-
continue;
|
|
657
|
-
}
|
|
658
|
-
registry$1.schemas.ids.set(key, schema);
|
|
659
|
-
}
|
|
660
|
-
};
|
|
661
|
-
const registerParameters = (parameters, registry$1) => {
|
|
662
|
-
if (!parameters) return;
|
|
663
|
-
for (const [key, schema] of Object.entries(parameters)) {
|
|
664
|
-
if (registry$1.parameters.ids.has(key)) throw new Error(`Parameter "${key}" is already registered`);
|
|
665
|
-
if (isAnyZodType(schema)) {
|
|
666
|
-
const path = [
|
|
667
|
-
"components",
|
|
668
|
-
"parameters",
|
|
669
|
-
key
|
|
670
|
-
];
|
|
671
|
-
const paramObject = createParameter(schema, void 0, {
|
|
672
|
-
registry: registry$1,
|
|
673
|
-
io: "input"
|
|
674
|
-
}, path);
|
|
675
|
-
registry$1.parameters.ids.set(key, paramObject);
|
|
676
|
-
registry$1.parameters.seen.set(schema, paramObject);
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
registry$1.parameters.ids.set(key, schema);
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
const registerHeaders = (headers, registry$1) => {
|
|
683
|
-
if (!headers) return;
|
|
684
|
-
for (const [key, schema] of Object.entries(headers)) {
|
|
685
|
-
if (registry$1.headers.ids.has(key)) throw new Error(`Header "${key}" is already registered`);
|
|
686
|
-
if (isAnyZodType(schema)) {
|
|
687
|
-
const path = [
|
|
688
|
-
"components",
|
|
689
|
-
"headers",
|
|
690
|
-
key
|
|
691
|
-
];
|
|
692
|
-
const headerObject = createHeader(schema, {
|
|
693
|
-
registry: registry$1,
|
|
694
|
-
io: "output"
|
|
695
|
-
}, path);
|
|
696
|
-
registry$1.headers.ids.set(key, headerObject);
|
|
697
|
-
registry$1.headers.seen.set(schema, headerObject);
|
|
698
|
-
continue;
|
|
699
|
-
}
|
|
700
|
-
registry$1.headers.ids.set(key, schema);
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
const registerResponses = (responses, registry$1) => {
|
|
704
|
-
if (!responses) return;
|
|
705
|
-
for (const [key, schema] of Object.entries(responses)) {
|
|
706
|
-
const path = [
|
|
707
|
-
"components",
|
|
708
|
-
"responses",
|
|
709
|
-
key
|
|
710
|
-
];
|
|
711
|
-
if (registry$1.responses.ids.has(key)) throw new Error(`Response "${key}" is already registered`);
|
|
712
|
-
const responseObject = createResponse(schema, {
|
|
713
|
-
registry: registry$1,
|
|
714
|
-
io: "output"
|
|
715
|
-
}, path);
|
|
716
|
-
registry$1.responses.ids.set(key, responseObject);
|
|
717
|
-
registry$1.responses.seen.set(schema, responseObject);
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
const registerRequestBodies = (requestBodies, registry$1) => {
|
|
721
|
-
if (!requestBodies) return;
|
|
722
|
-
for (const [key, schema] of Object.entries(requestBodies)) {
|
|
723
|
-
if (registry$1.requestBodies.ids.has(key)) throw new Error(`RequestBody "${key}" is already registered`);
|
|
724
|
-
if (isAnyZodType(schema)) {
|
|
725
|
-
const path = [
|
|
726
|
-
"components",
|
|
727
|
-
"requestBodies",
|
|
728
|
-
key
|
|
729
|
-
];
|
|
730
|
-
const requestBodyObject = createRequestBody(schema, {
|
|
731
|
-
registry: registry$1,
|
|
732
|
-
io: "input"
|
|
733
|
-
}, path);
|
|
734
|
-
registry$1.requestBodies.ids.set(key, requestBodyObject);
|
|
735
|
-
continue;
|
|
736
|
-
}
|
|
737
|
-
registry$1.requestBodies.ids.set(key, schema);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
const registerCallbacks = (callbacks, registry$1) => {
|
|
741
|
-
if (!callbacks) return;
|
|
742
|
-
for (const [key, schema] of Object.entries(callbacks)) {
|
|
743
|
-
if (registry$1.callbacks.ids.has(key)) throw new Error(`Callback "${key}" is already registered`);
|
|
744
|
-
const path = [
|
|
745
|
-
"components",
|
|
746
|
-
"callbacks",
|
|
747
|
-
key
|
|
748
|
-
];
|
|
749
|
-
const callbackObject = createCallback(schema, registry$1, path);
|
|
750
|
-
registry$1.callbacks.ids.set(key, callbackObject);
|
|
751
|
-
registry$1.callbacks.seen.set(schema, callbackObject);
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
const registerPathItems = (pathItems, registry$1) => {
|
|
755
|
-
if (!pathItems) return;
|
|
756
|
-
for (const [key, schema] of Object.entries(pathItems)) {
|
|
757
|
-
if (registry$1.pathItems.ids.has(key)) throw new Error(`PathItem "${key}" is already registered`);
|
|
758
|
-
const path = [
|
|
759
|
-
"components",
|
|
760
|
-
"pathItems",
|
|
761
|
-
key
|
|
762
|
-
];
|
|
763
|
-
const pathItemObject = createPathItem(schema, registry$1, path);
|
|
764
|
-
registry$1.pathItems.ids.set(key, pathItemObject);
|
|
765
|
-
registry$1.pathItems.seen.set(schema, pathItemObject);
|
|
766
|
-
continue;
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
const createIOSchemas = (ctx) => {
|
|
770
|
-
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.schemas[ctx.io]), ctx);
|
|
771
|
-
for (const [key, schema] of Object.entries(components)) ctx.registry.schemas.ids.set(key, schema);
|
|
772
|
-
for (const [key, schema] of Object.entries(schemas)) {
|
|
773
|
-
const ioSchema = ctx.registry.schemas[ctx.io].get(key);
|
|
774
|
-
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
|
775
|
-
}
|
|
776
|
-
for (const [key, value] of Object.entries(manual)) {
|
|
777
|
-
const manualSchema = ctx.registry.schemas.manual.get(key);
|
|
778
|
-
if (!manualSchema) continue;
|
|
779
|
-
if (components[key]) manualSchema[ctx.io].used = true;
|
|
780
|
-
Object.assign(manualSchema[ctx.io].schemaObject, value);
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
const createManualSchemas = (registry$1) => {
|
|
784
|
-
for (const [key, value] of registry$1.schemas.manual) if (!value.input.used) {
|
|
785
|
-
const io = zod_v4_core.globalRegistry.get(value.zodType)?.unusedIO ?? "output";
|
|
786
|
-
const schema = value[io].schemaObject;
|
|
787
|
-
registry$1.schemas.ids.set(key, schema);
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
|
-
const createComponents = (registry$1, opts) => {
|
|
791
|
-
createIOSchemas({
|
|
792
|
-
registry: registry$1,
|
|
793
|
-
io: "input",
|
|
794
|
-
opts
|
|
795
|
-
});
|
|
796
|
-
createIOSchemas({
|
|
797
|
-
registry: registry$1,
|
|
798
|
-
io: "output",
|
|
799
|
-
opts
|
|
800
|
-
});
|
|
801
|
-
createManualSchemas(registry$1);
|
|
802
|
-
const components = {};
|
|
803
|
-
if (registry$1.schemas.ids.size > 0) components.schemas = Object.fromEntries(registry$1.schemas.ids);
|
|
804
|
-
if (registry$1.headers.ids.size > 0) components.headers = Object.fromEntries(registry$1.headers.ids);
|
|
805
|
-
if (registry$1.requestBodies.ids.size > 0) components.requestBodies = Object.fromEntries(registry$1.requestBodies.ids);
|
|
806
|
-
if (registry$1.responses.ids.size > 0) components.responses = Object.fromEntries(registry$1.responses.ids);
|
|
807
|
-
if (registry$1.parameters.ids.size > 0) components.parameters = Object.fromEntries(registry$1.parameters.ids);
|
|
808
|
-
if (registry$1.callbacks.ids.size > 0) components.callbacks = Object.fromEntries(registry$1.callbacks.ids);
|
|
809
|
-
if (registry$1.pathItems.ids.size > 0) components.pathItems = Object.fromEntries(registry$1.pathItems.ids);
|
|
810
|
-
return components;
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
//#endregion
|
|
814
|
-
Object.defineProperty(exports, 'createComponents', {
|
|
815
|
-
enumerable: true,
|
|
816
|
-
get: function () {
|
|
817
|
-
return createComponents;
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
Object.defineProperty(exports, 'createParameter', {
|
|
821
|
-
enumerable: true,
|
|
822
|
-
get: function () {
|
|
823
|
-
return createParameter;
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
Object.defineProperty(exports, 'createPaths', {
|
|
827
|
-
enumerable: true,
|
|
828
|
-
get: function () {
|
|
829
|
-
return createPaths;
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
Object.defineProperty(exports, 'createRegistry', {
|
|
833
|
-
enumerable: true,
|
|
834
|
-
get: function () {
|
|
835
|
-
return createRegistry;
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
Object.defineProperty(exports, 'createSchema', {
|
|
839
|
-
enumerable: true,
|
|
840
|
-
get: function () {
|
|
841
|
-
return createSchema;
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
Object.defineProperty(exports, 'isAnyZodType', {
|
|
845
|
-
enumerable: true,
|
|
846
|
-
get: function () {
|
|
847
|
-
return isAnyZodType;
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
Object.defineProperty(exports, 'unwrapZodObject', {
|
|
851
|
-
enumerable: true,
|
|
852
|
-
get: function () {
|
|
853
|
-
return unwrapZodObject;
|
|
854
|
-
}
|
|
855
|
-
});
|