zod-openapi 5.4.6 → 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 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:** To get full TypeScript support for the OpenAPI-specific properties in `.meta()`, you need to import `zod-openapi` somewhere in your project. This import provides TypeScript type definitions that extend Zod's `.meta()` interface at compile-time (no runtime changes), enabling your IDE and TypeScript compiler to recognize the additional properties (like `id`, `param`, `header`, etc.). In most cases this will be done where you call `createDocument` or other zod-openapi functions.
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 = jsonSchema.anyOf;
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
@@ -1,5 +1,9 @@
1
1
  {
2
- "main": "../dist/api.cjs",
3
- "module": "../dist/api.js",
4
- "types": "./index.d.cts"
2
+ "type": "module",
3
+ "main": "../lib/api.cjs",
4
+ "module": "../lib/api.mjs",
5
+ "types": "../lib/api.d.cts",
6
+ "engines": {
7
+ "node": ">=22.14.0"
8
+ }
5
9
  }
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 };
@@ -1,3 +1,2 @@
1
- import { a as unwrapZodObject, n as createRegistry, o as isAnyZodType, t as createComponents } from "./components-DiNDbisK.mjs";
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 };