zod-openapi 5.1.0 → 5.2.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/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-C0rn1JRo.js');
1
+ const require_components = require('./components-BAZgpKwe.js');
2
2
 
3
3
  exports.createComponents = require_components.createComponents;
4
4
  exports.createRegistry = require_components.createRegistry;
package/dist/api.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-Ci7Vy4JN.mjs";
1
+ import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-DPhhXqww.mjs";
2
2
 
3
3
  export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
@@ -261,6 +261,10 @@ const override = (ctx) => {
261
261
  if (def.values.includes(void 0)) break;
262
262
  break;
263
263
  }
264
+ case "undefined": {
265
+ ctx.jsonSchema.not = {};
266
+ break;
267
+ }
264
268
  }
265
269
  };
266
270
  const validate = (ctx, opts) => {
@@ -269,6 +273,13 @@ const validate = (ctx, opts) => {
269
273
  const allowEmptySchema = opts.allowEmptySchema?.[def.type];
270
274
  if (allowEmptySchema === true || allowEmptySchema?.[ctx.io]) return;
271
275
  switch (def.type) {
276
+ case "optional": {
277
+ validate({
278
+ ...ctx,
279
+ zodSchema: def.innerType
280
+ }, opts);
281
+ return;
282
+ }
272
283
  case "any": return;
273
284
  case "unknown": return;
274
285
  case "pipe": {
@@ -238,6 +238,10 @@ const override = (ctx) => {
238
238
  if (def.values.includes(void 0)) break;
239
239
  break;
240
240
  }
241
+ case "undefined": {
242
+ ctx.jsonSchema.not = {};
243
+ break;
244
+ }
241
245
  }
242
246
  };
243
247
  const validate = (ctx, opts) => {
@@ -246,6 +250,13 @@ const validate = (ctx, opts) => {
246
250
  const allowEmptySchema = opts.allowEmptySchema?.[def.type];
247
251
  if (allowEmptySchema === true || allowEmptySchema?.[ctx.io]) return;
248
252
  switch (def.type) {
253
+ case "optional": {
254
+ validate({
255
+ ...ctx,
256
+ zodSchema: def.innerType
257
+ }, opts);
258
+ return;
259
+ }
249
260
  case "any": return;
250
261
  case "unknown": return;
251
262
  case "pipe": {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-C0rn1JRo.js');
1
+ const require_components = require('./components-BAZgpKwe.js');
2
2
 
3
3
  //#region src/create/document.ts
4
4
  const createDocument = (zodOpenApiObject, opts = {}) => {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createComponents, createPaths, createRegistry, createSchema } from "./components-Ci7Vy4JN.mjs";
1
+ import { createComponents, createPaths, createRegistry, createSchema } from "./components-DPhhXqww.mjs";
2
2
 
3
3
  //#region src/create/document.ts
4
4
  const createDocument = (zodOpenApiObject, opts = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",
@@ -42,6 +42,7 @@
42
42
  ],
43
43
  "devDependencies": {
44
44
  "@arethetypeswrong/cli": "0.18.2",
45
+ "@changesets/changelog-github": "0.5.1",
45
46
  "@changesets/cli": "2.29.5",
46
47
  "@redocly/cli": "1.34.4",
47
48
  "@types/node": "22.15.21",
@@ -52,7 +53,7 @@
52
53
  "skuba": "11.1.0",
53
54
  "tsdown": "0.12.9",
54
55
  "yaml": "2.8.0",
55
- "zod": "4.0.1"
56
+ "zod": "4.0.5"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "zod": "^3.25.74 || ^4.0.0"