@orpc/zod 1.10.1 → 1.10.3

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/index.mjs CHANGED
@@ -724,7 +724,7 @@ class ZodToJsonSchemaConverter {
724
724
  const anyOf = [];
725
725
  let required = true;
726
726
  for (const item of schema_._def.options) {
727
- const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
727
+ const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
728
728
  if (!itemRequired) {
729
729
  required = false;
730
730
  if (itemJson !== this.unsupportedJsonSchema) {
@@ -734,9 +734,6 @@ class ZodToJsonSchemaConverter {
734
734
  anyOf.push(itemJson);
735
735
  }
736
736
  }
737
- if (anyOf.length === 1) {
738
- return [required, anyOf[0]];
739
- }
740
737
  return [required, { anyOf }];
741
738
  }
742
739
  case ZodFirstPartyTypeKind.ZodIntersection: {
@@ -744,7 +741,7 @@ class ZodToJsonSchemaConverter {
744
741
  const allOf = [];
745
742
  let required = false;
746
743
  for (const item of [schema_._def.left, schema_._def.right]) {
747
- const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
744
+ const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
748
745
  allOf.push(itemJson);
749
746
  if (itemRequired) {
750
747
  required = true;
@@ -446,7 +446,7 @@ class ZodToJsonSchemaConverter {
446
446
  const anyOf = [];
447
447
  let required = true;
448
448
  for (const item of union._zod.def.options) {
449
- const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
449
+ const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
450
450
  if (!itemRequired) {
451
451
  required = false;
452
452
  }
@@ -460,14 +460,14 @@ class ZodToJsonSchemaConverter {
460
460
  }
461
461
  }
462
462
  }
463
- return [required, anyOf.length === 1 ? anyOf[0] : { anyOf }];
463
+ return [required, { anyOf }];
464
464
  }
465
465
  case "intersection": {
466
466
  const intersection = schema2;
467
467
  const json = { allOf: [] };
468
468
  let required = false;
469
469
  for (const item of [intersection._zod.def.left, intersection._zod.def.right]) {
470
- const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
470
+ const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
471
471
  json.allOf.push(itemJson);
472
472
  if (itemRequired) {
473
473
  required = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/zod",
3
3
  "type": "module",
4
- "version": "1.10.1",
4
+ "version": "1.10.3",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -30,15 +30,15 @@
30
30
  ],
31
31
  "peerDependencies": {
32
32
  "zod": ">=3.25.0",
33
- "@orpc/contract": "1.10.1",
34
- "@orpc/server": "1.10.1"
33
+ "@orpc/contract": "1.10.3",
34
+ "@orpc/server": "1.10.3"
35
35
  },
36
36
  "dependencies": {
37
37
  "escape-string-regexp": "^5.0.0",
38
38
  "wildcard-match": "^5.1.3",
39
- "@orpc/json-schema": "1.10.1",
40
- "@orpc/shared": "1.10.1",
41
- "@orpc/openapi": "1.10.1"
39
+ "@orpc/shared": "1.10.3",
40
+ "@orpc/openapi": "1.10.3",
41
+ "@orpc/json-schema": "1.10.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "zod": "^4.1.12"