zod-openapi 5.4.5 → 6.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 +3 -3
- package/api/package.json +7 -3
- package/lib/api.cjs +6 -0
- package/lib/api.d.cts +7 -0
- package/lib/api.d.mts +7 -0
- package/{dist → lib}/api.mjs +2 -3
- package/{dist/components-fd4LXedu.cjs → lib/components-BDEwP6Uu.cjs} +249 -212
- package/{dist/components-B1DX_zYv.d.mts → lib/components-DfsFcO5r.d.cts} +99 -16
- package/{dist/components-D3KCJ9k6.d.cts → lib/components-DfsFcO5r.d.mts} +99 -16
- package/{dist/components-WUsO5AOL.mjs → lib/components-DgApn4JL.mjs} +219 -182
- package/{dist → lib}/index.cjs +2 -13
- package/lib/index.d.cts +332 -0
- package/lib/index.d.mts +332 -0
- package/{dist → lib}/index.mjs +2 -8
- package/package.json +20 -27
- package/api/index.d.cts +0 -1
- package/api/index.d.ts +0 -1
- package/dist/api.cjs +0 -6
- package/dist/api.d.cts +0 -11
- package/dist/api.d.mts +0 -11
- package/dist/index.d.cts +0 -32
- package/dist/index.d.mts +0 -32
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ pnpm install zod zod-openapi
|
|
|
33
33
|
|
|
34
34
|
Use Zod's native `.meta()` method to add OpenAPI metadata to your schemas. This library leverages Zod's built-in metadata functionality - no monkey patching or additional setup is required. Simply call `.meta()` on any Zod schema and it accepts an object with the following options:
|
|
35
35
|
|
|
36
|
-
> **Note:**
|
|
36
|
+
> **Note:** For full TypeScript support of OpenAPI properties in `.meta()`, simply import `zod-openapi` in your project or add `/// <reference types="zod-openapi" />` anywhere in your project. This provides compile-time type definitions for properties like `id`, `param`, `header`, etc.
|
|
37
37
|
|
|
38
38
|
| Option | Description |
|
|
39
39
|
| ---------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
@@ -287,8 +287,8 @@ createDocument(doc, {
|
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
if (def.type === 'union') {
|
|
290
|
-
jsonSchema.oneOf
|
|
291
|
-
delete jsonSchema.anyOf;
|
|
290
|
+
ctx.jsonSchema.oneOf ??= ctx.jsonSchema.anyOf;
|
|
291
|
+
delete ctx.jsonSchema.anyOf;
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
},
|
package/api/package.json
CHANGED
package/lib/api.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_components = require("./components-BDEwP6Uu.cjs");
|
|
3
|
+
exports.createComponents = require_components.createComponents;
|
|
4
|
+
exports.createRegistry = require_components.createRegistry;
|
|
5
|
+
exports.isAnyZodType = require_components.isAnyZodType;
|
|
6
|
+
exports.unwrapZodObject = require_components.unwrapZodObject;
|
package/lib/api.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { F as ZodOpenApiOverrideContext, Ft as isAnyZodType, I as ZodOpenApiOverrideMeta, L as ZodOpenApiOverrideMetaContext, M as ZodOpenApiBaseMetadata, N as ZodOpenApiMetadata, P as ZodOpenApiOverride, n as createComponents, r as createRegistry, t as ComponentRegistry } from "./components-DfsFcO5r.cjs";
|
|
2
|
+
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
|
+
|
|
4
|
+
//#region src/create/object.d.ts
|
|
5
|
+
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type ComponentRegistry, type ZodOpenApiBaseMetadata, type ZodOpenApiMetadata, type ZodOpenApiOverride, type ZodOpenApiOverrideContext, type ZodOpenApiOverrideMeta, type ZodOpenApiOverrideMetaContext, createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
package/lib/api.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { F as ZodOpenApiOverrideContext, Ft as isAnyZodType, I as ZodOpenApiOverrideMeta, L as ZodOpenApiOverrideMetaContext, M as ZodOpenApiBaseMetadata, N as ZodOpenApiMetadata, P as ZodOpenApiOverride, n as createComponents, r as createRegistry, t as ComponentRegistry } from "./components-DfsFcO5r.mjs";
|
|
2
|
+
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
|
+
|
|
4
|
+
//#region src/create/object.d.ts
|
|
5
|
+
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type ComponentRegistry, type ZodOpenApiBaseMetadata, type ZodOpenApiMetadata, type ZodOpenApiOverride, type ZodOpenApiOverrideContext, type ZodOpenApiOverrideMeta, type ZodOpenApiOverrideMetaContext, createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
package/{dist → lib}/api.mjs
RENAMED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as unwrapZodObject, n as createRegistry, o as isAnyZodType, t as createComponents } from "./components-
|
|
2
|
-
|
|
3
|
-
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
|
1
|
+
import { a as unwrapZodObject, n as createRegistry, o as isAnyZodType, t as createComponents } from "./components-DgApn4JL.mjs";
|
|
2
|
+
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|