zod 4.2.0-canary.20250825T230433 → 4.2.0-canary.20250825T235836

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.2.0-canary.20250825T230433",
3
+ "version": "4.2.0-canary.20250825T235836",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -695,14 +695,16 @@ describe("toJSONSchema", () => {
695
695
  const schema = z.tuple([z.string(), z.number()]);
696
696
  expect(z.toJSONSchema(schema, { target: "openapi-3.0" })).toMatchInlineSnapshot(`
697
697
  {
698
- "items": [
699
- {
700
- "type": "string",
701
- },
702
- {
703
- "type": "number",
704
- },
705
- ],
698
+ "items": {
699
+ "anyOf": [
700
+ {
701
+ "type": "string",
702
+ },
703
+ {
704
+ "type": "number",
705
+ },
706
+ ],
707
+ },
706
708
  "maxItems": 2,
707
709
  "minItems": 2,
708
710
  "type": "array",
@@ -714,17 +716,19 @@ describe("toJSONSchema", () => {
714
716
  const schema = z.tuple([z.string(), z.number()]).rest(z.boolean());
715
717
  expect(z.toJSONSchema(schema, { target: "openapi-3.0" })).toMatchInlineSnapshot(`
716
718
  {
717
- "items": [
718
- {
719
- "type": "string",
720
- },
721
- {
722
- "type": "number",
723
- },
724
- {
725
- "type": "boolean",
726
- },
727
- ],
719
+ "items": {
720
+ "anyOf": [
721
+ {
722
+ "type": "string",
723
+ },
724
+ {
725
+ "type": "number",
726
+ },
727
+ {
728
+ "type": "boolean",
729
+ },
730
+ ],
731
+ },
728
732
  "minItems": 2,
729
733
  "type": "array",
730
734
  }
@@ -384,9 +384,11 @@ export class JSONSchemaGenerator {
384
384
  json.items = rest;
385
385
  }
386
386
  } else if (this.target === "openapi-3.0") {
387
- json.items = [...prefixItems];
387
+ json.items = {
388
+ anyOf: [...prefixItems],
389
+ };
388
390
  if (rest) {
389
- json.items.push(rest);
391
+ json.items.anyOf!.push(rest);
390
392
  }
391
393
  json.minItems = prefixItems.length;
392
394
  if (!rest) {
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 1,
4
- patch: 1 as number,
4
+ patch: 2 as number,
5
5
  } as const;
@@ -302,9 +302,11 @@ class JSONSchemaGenerator {
302
302
  }
303
303
  }
304
304
  else if (this.target === "openapi-3.0") {
305
- json.items = [...prefixItems];
305
+ json.items = {
306
+ anyOf: [...prefixItems],
307
+ };
306
308
  if (rest) {
307
- json.items.push(rest);
309
+ json.items.anyOf.push(rest);
308
310
  }
309
311
  json.minItems = prefixItems.length;
310
312
  if (!rest) {
@@ -298,9 +298,11 @@ export class JSONSchemaGenerator {
298
298
  }
299
299
  }
300
300
  else if (this.target === "openapi-3.0") {
301
- json.items = [...prefixItems];
301
+ json.items = {
302
+ anyOf: [...prefixItems],
303
+ };
302
304
  if (rest) {
303
- json.items.push(rest);
305
+ json.items.anyOf.push(rest);
304
306
  }
305
307
  json.minItems = prefixItems.length;
306
308
  if (!rest) {
@@ -4,5 +4,5 @@ exports.version = void 0;
4
4
  exports.version = {
5
5
  major: 4,
6
6
  minor: 1,
7
- patch: 1,
7
+ patch: 2,
8
8
  };
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 1,
4
- patch: 1,
4
+ patch: 2,
5
5
  };