Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

chore: fix peer dep issue when using zod-4, causing types to not appear (#2045)

Rahul Tarak8741165180e5
diff --git a/.changeset/petite-lamps-cough.md b/.changeset/petite-lamps-cough.md
new file mode 100644
index 000000000..332d1e747
--- /dev/null
+++ b/.changeset/petite-lamps-cough.md
@@ -0,0 +1,6 @@
+---
+'@composio/core': patch
+'@composio/json-schema-to-zod': patch
+---
+
+Add zod 4 support via zod/v3 and fix zod schema parsing
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7159eaf67..4221ecf7b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -268,7 +268,7 @@ importers:
devDependencies:
'@cloudflare/vitest-pool-workers':
specifier: 'catalog:'
+ version: 0.9.2(@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected])
typescript:
specifier: 'catalog:'
version: 5.9.2
@@ -384,7 +384,7 @@ importers:
version: 16.5.0
zod-to-json-schema:
specifier: ^3.24.5
- version: 3.24.5([email protected])
+ version: 3.24.5([email protected])
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -437,13 +437,13 @@ importers:
version: 0.4.20(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
'@llamaindex/workflow':
specifier: ^1.1.24
dotenv:
specifier: ^16.4.1
version: 16.6.1
llamaindex:
specifier: ^0.12.0
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -487,7 +487,7 @@ importers:
dependencies:
'@ai-sdk/openai':
specifier: ^2.0.35
- version: 2.0.35([email protected])
+ version: 2.0.35([email protected])
'@composio/core':
specifier: workspace:*
version: link:../../packages/core
@@ -499,7 +499,7 @@ importers:
version: 1.18.0
ai:
specifier: 'catalog:'
- version: 5.0.44([email protected])
+ version: 5.0.44([email protected])
dotenv:
specifier: ^16.4.1
version: 16.6.1
@@ -515,7 +515,7 @@ importers:
dependencies:
'@ai-sdk/openai':
specifier: ^1.3.16
- version: 1.3.22([email protected])
+ version: 1.3.22([email protected])
'@composio/core':
specifier: workspace:*
version: link:../../packages/core
@@ -524,7 +524,7 @@ importers:
version: link:../../packages/providers/vercel
ai:
specifier: 'catalog:'
- version: 5.0.44([email protected])
+ version: 5.0.44([email protected])
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -590,7 +590,7 @@ importers:
dependencies:
'@ai-sdk/openai':
specifier: ^1.3.16
- version: 1.3.22([email protected])
+ version: 1.3.22([email protected])
'@composio/core':
specifier: workspace:*
version: link:../../packages/core
@@ -599,7 +599,7 @@ importers:
version: link:../../packages/providers/vercel
ai:
specifier: 'catalog:'
- version: 5.0.44([email protected])
+ version: 5.0.44([email protected])
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -618,10 +618,13 @@ importers:
version: 16.5.0
openai:
specifier: ^5.19.1
+ zod:
+ specifier: 'catalog:'
+ version: 3.25.76
zod-to-json-schema:
specifier: ^3.24.5
- version: 3.24.5([email protected])
+ version: 3.24.5([email protected])
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -650,7 +653,7 @@ importers:
dependencies:
'@ai-sdk/openai':
specifier: ^2.0.16
- version: 2.0.16([email protected])
+ version: 2.0.16([email protected])
'@composio/core':
specifier: workspace:*
version: link:../../packages/core
@@ -662,10 +665,13 @@ importers:
version: 1.18.0
ai:
specifier: 'catalog:'
- version: 5.0.44([email protected])
+ version: 5.0.44([email protected])
dotenv:
specifier: ^16.5.0
version: 16.5.0
+ zod-to-json-schema:
+ specifier: ^3.24.6
+ version: 3.24.6([email protected])
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -761,7 +767,7 @@ importers:
version: 0.85.2([email protected])
'@effect/vitest':
specifier: ^0.23.8
'@types/bun':
specifier: ^1.2.16
version: 1.2.16
@@ -870,7 +876,7 @@ importers:
version: 0.52.0
'@mastra/mcp':
specifier: ^0.12.0
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -924,7 +930,7 @@ importers:
dependencies:
'@langchain/core':
specifier: ^0.3.63
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -946,7 +952,7 @@ importers:
dependencies:
llamaindex:
specifier: ^0.12.0
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -1900,138 +1906,163 @@ packages:
resolution: {integrity: sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-D8n8wgWmPDakc83LORcfJepdOSN6MvWNzzz2ux0MnIbOqdieRZwVYY32zxVx+IFUT8er5KPcyU3XXsn+GzG/0Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-0DZzkvuEOqQUP9mo2kjjKNok5AmnOr1jB2XYjkaoNRwpAYMDzRmAqUIa1nRi58S2WswqSfPOWLNOr0FDT3H5RQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-EGZ1xwhBI7dNISwxjChqBGELCWMGDvmxZXKjQRuqMrakhO8QoMgqCrdjnAqJq/CScxfRn+Bb7suXBElKQpPDiw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-sD7J+h5nFLMMmOXYH4DD9UtSNBD05tWSSdWAcEyzqW8Cn5UxXvsHAxmxSesYUsTOBmUnjtxghKDl15EvfqLFbQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-NEE2vQ6wcxYav1/A22OOxoSOGiKnNmDzCYFOZ949xFmrWZOVII1Bp3NqVVpvj+3UeHMFyN5eP/V5hzViQ5CZNA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-DOYMrDm5E6/8bm/yQLCWyuDJwUnlevR8xtF8bs+gjZ7cyUNYXiSf/E8Kp0Ss5xasIaXSHzb888V1BE4i1hFhAA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==}
@@ -2386,24 +2417,28 @@ packages:
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-wFyZ7X470YJQtpKot4xCY3gpdn8lE9nTlldG07/kJYexCUpX1piX+MBfZdvulo+t1yADFVEuzFfVHfklfEx8kw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-gEbH9rv9o7I12qPyvZNVTyP/PWKqOp8clvnoYZQiX800KkqsaJZuOXkWgMa7ANCCh/oEN2ZQheh3yH8/kWPSEg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-Cf8sr0ufuC/nu/yQ76AnarbSAXcwG/wj+1xFPNbyNo8ltA6kw5d5YqO8kQuwVIxk13SBdtgXrNyom3ZosHAy4A==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-ay5+qADDN3rwRbRpEhTOreOn1OyJIXS60tg9WMYTWCy3fB6rGoyjLVxc4dR9PYjEdR2iDYsaF5h03NA+XuYPQQ==}
@@ -2967,36 +3002,42 @@ packages:
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==}
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==}
@@ -3110,56 +3151,67 @@ packages:
resolution: {integrity: sha512-gTJ/JnnjCMc15uwB10TTATBEhK9meBIY+gXP4s0sHD1zHOaIh4Dmy1X9wup18IiY9tTNk5gJc4yx9ctj/fjrIw==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-ZJ3gZynL1LDSIvRfz0qXtTNs56n5DI2Mq+WACWZ7yGHFUEirHBRt7fyIk0NsCKhmRhn7WAcjgSkSVVxKlPNFFw==}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-8FnkipasmOOSSlfucGYEu58U8cxEdhziKjPD2FIa0ONVMxvl/hmONtX/7y4vGjdUhjcTHlKlDhw3H9t98fPvyA==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-KPPyAdlcIZ6S9C3S2cndXDkV0Bb1OSMsX0Eelr2Bay4EsF9yi9u9uzc9RniK3mcUGCLhWY9oLr6er80P5DE6XA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-HPGDIH0/ZzAZjvtlXj6g+KDQ9ZMHfSP553za7o2Odegb/BEfwJcR0Sw0RLNpQ9nC6Gy8s+3mSS9xjZ0n3rhcYg==}
cpu: [loong64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-gEmwbOws4U4GLAJDhhtSPWPXUzDfMRedT3hFMyRAvM9Mrnj+dJIFIeL7otsv2WF3D7GrV0GIewW0y28dOYWkmw==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-XXKvo2e+wFtXZF/9xoWohHg+MuRnvO29TI5Hqe9xwN5uN8NKUYy7tXUG3EZAlfchufNCTHNGjEx7uN78KsBo0g==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-ruf3hPWhjw6uDFsOAzmbNIvlXFXlBQ4nk57Sec8E8rUxs/AI4HD6xmiiasOOx/3QxS2f5eQMKTAwk7KHwpzr/Q==}
cpu: [riscv64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-QmNIAqDiEMEvFV15rsSnjoSmO0+eJLoKRD9EAa9rrYNwO/XRCtOGM3A5A0X+wmG+XRrw9Fxdsw+LnyYiZWWcVw==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-jAHr/S0iiBtFyzjhOkAics/2SrXE092qyqEg96e90L3t9Op8OTzS6+IX0Fy5wCt2+KqeHAkti+eitV0wvblEoQ==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-3yATWgdeXyuHtBhrLt98w+5fKurdqvs8B53LaoKD7P7H7FKOONLsBVMNl9ghPQZQuYcceV5CDyPfyfGpMWD9mQ==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-wVzXp2qDSCOpcBCT5WRWLmpJRIzv23valvcTwMHEobkjippNf+C3ys/+wf07poPkeNix0paTNemB2XrHr2TnGw==}
@@ -6735,8 +6787,8 @@ packages:
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
- resolution: {integrity: sha512-HI32jTq0AUAC125z30E8bQNz0RQ+9Uc+4J7V97gLYjZVKRjeydPgGt6dvQzFrav7MYOUGFqqOGiHpA/fdbd0cQ==}
+ resolution: {integrity: sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==}
snapshots:
@@ -6763,41 +6815,23 @@ snapshots:
'@ai-sdk/provider-utils': 3.0.7([email protected])
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.7([email protected])
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 2.0.0
'@ai-sdk/provider-utils': 3.0.9([email protected])
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.9([email protected])
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 1.1.3
'@ai-sdk/provider-utils': 2.2.8([email protected])
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 1.1.3
- '@ai-sdk/provider-utils': 2.2.8([email protected])
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.4([email protected])
- zod: 4.1.9
+ '@ai-sdk/provider-utils': 3.0.4([email protected])
+ zod: 3.25.76
dependencies:
@@ -6805,12 +6839,6 @@ snapshots:
'@ai-sdk/provider-utils': 3.0.9([email protected])
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.9([email protected])
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 1.1.3
@@ -6818,20 +6846,13 @@ snapshots:
secure-json-parse: 2.7.0
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 1.1.3
- nanoid: 3.3.11
- secure-json-parse: 2.7.0
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 2.0.0
'@standard-schema/spec': 1.0.0
eventsource-parser: 3.0.3
- zod: 4.1.9
- zod-to-json-schema: 3.24.6([email protected])
+ zod: 3.25.76
+ zod-to-json-schema: 3.24.6([email protected])
dependencies:
@@ -6841,14 +6862,6 @@ snapshots:
zod: 3.25.76
zod-to-json-schema: 3.24.6([email protected])
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@standard-schema/spec': 1.0.0
- eventsource-parser: 3.0.6
- zod: 4.1.9
- zod-to-json-schema: 3.24.6([email protected])
-
dependencies:
'@ai-sdk/provider': 2.0.0
@@ -6856,13 +6869,6 @@ snapshots:
eventsource-parser: 3.0.6
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@standard-schema/spec': 1.0.0
- eventsource-parser: 3.0.6
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 2.0.0
@@ -6870,13 +6876,6 @@ snapshots:
eventsource-parser: 3.0.6
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider': 2.0.0
- '@standard-schema/spec': 1.0.0
- eventsource-parser: 3.0.6
- zod: 4.1.9
-
'@ai-sdk/[email protected]':
dependencies:
json-schema: 0.4.0
@@ -6895,16 +6894,6 @@ snapshots:
optionalDependencies:
zod: 3.25.76
- dependencies:
- '@ai-sdk/provider-utils': 2.2.8([email protected])
- '@ai-sdk/ui-utils': 1.2.11([email protected])
- react: 18.3.1
- swr: 2.3.3([email protected])
- throttleit: 2.1.0
- optionalDependencies:
- zod: 4.1.9
-
dependencies:
'@ai-sdk/provider': 1.1.3
@@ -6912,13 +6901,6 @@ snapshots:
zod: 3.25.76
zod-to-json-schema: 3.24.6([email protected])
- dependencies:
- '@ai-sdk/provider': 1.1.3
- '@ai-sdk/provider-utils': 2.2.8([email protected])
- zod: 4.1.9
- zod-to-json-schema: 3.24.6([email protected])
-
'@alloc/[email protected]': {}
'@anthropic-ai/[email protected]': {}
@@ -7126,7 +7108,7 @@ snapshots:
optionalDependencies:
workerd: 1.20250913.0
dependencies:
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -7280,7 +7262,7 @@ snapshots:
dependencies:
effect: 3.16.16
dependencies:
effect: 3.16.16
@@ -7494,9 +7476,9 @@ snapshots:
'@eslint/core': 0.15.0
levn: 0.4.1
dependencies:
- zod: 4.1.9
+ zod: 4.1.12
'@gerrit0/[email protected]':
dependencies:
@@ -7875,14 +7857,14 @@ snapshots:
transitivePeerDependencies:
- openai
dependencies:
'@cfworker/json-schema': 4.1.1
ansi-styles: 5.2.0
camelcase: 6.3.0
decamelize: 1.2.0
js-tiktoken: 1.0.20
mustache: 4.2.0
p-queue: 6.6.2
p-retry: 4.6.2
@@ -7978,11 +7960,11 @@ snapshots:
'@llamaindex/[email protected]':
dependencies:
- '@finom/zod-to-json-schema': 3.24.11([email protected])
+ '@finom/zod-to-json-schema': 3.24.11([email protected])
'@llamaindex/env': 0.1.30
'@types/node': 24.6.2
magic-bytes.js: 1.12.1
- zod: 4.1.9
+ zod: 4.1.12
transitivePeerDependencies:
- '@huggingface/transformers'
- gpt-tokenizer
@@ -8018,7 +8000,7 @@ snapshots:
rxjs: 7.8.2
zod: 3.25.76
optionalDependencies:
'@modelcontextprotocol/sdk': 1.18.0
hono: 4.9.7
@@ -8026,9 +8008,9 @@ snapshots:
rxjs: 7.8.2
zod: 3.25.76
optionalDependencies:
- zod: 4.1.9
+ zod: 4.1.12
dependencies:
@@ -8043,11 +8025,11 @@ snapshots:
- rxjs
- zod
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
- '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/[email protected])([email protected])([email protected])([email protected])([email protected])
transitivePeerDependencies:
- '@modelcontextprotocol/sdk'
- hono
@@ -8056,11 +8038,11 @@ snapshots:
- rxjs
- zod
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
- '@llamaindex/workflow-core': 1.3.3([email protected])
+ '@llamaindex/workflow-core': 1.3.3([email protected])
transitivePeerDependencies:
- '@modelcontextprotocol/sdk'
- hono
@@ -8142,63 +8124,6 @@ snapshots:
- valibot
- zod-openapi
- dependencies:
- '@a2a-js/sdk': 0.2.5
- '@ai-sdk/provider': 1.1.3
- '@ai-sdk/provider-utils': 2.2.8([email protected])
- '@ai-sdk/provider-utils-v5': '@ai-sdk/[email protected]([email protected])'
- '@ai-sdk/provider-v5': '@ai-sdk/[email protected]'
- '@ai-sdk/ui-utils': 1.2.11([email protected])
- '@opentelemetry/api': 1.9.0
- '@opentelemetry/auto-instrumentations-node': 0.62.1(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))
- '@opentelemetry/core': 2.0.1(@opentelemetry/[email protected])
- '@opentelemetry/exporter-trace-otlp-grpc': 0.203.0(@opentelemetry/[email protected])
- '@opentelemetry/exporter-trace-otlp-http': 0.203.0(@opentelemetry/[email protected])
- '@opentelemetry/otlp-exporter-base': 0.203.0(@opentelemetry/[email protected])
- '@opentelemetry/otlp-transformer': 0.203.0(@opentelemetry/[email protected])
- '@opentelemetry/resources': 2.0.1(@opentelemetry/[email protected])
- '@opentelemetry/sdk-metrics': 2.0.1(@opentelemetry/[email protected])
- '@opentelemetry/sdk-node': 0.203.0(@opentelemetry/[email protected])
- '@opentelemetry/sdk-trace-base': 2.0.1(@opentelemetry/[email protected])
- '@opentelemetry/sdk-trace-node': 2.0.1(@opentelemetry/[email protected])
- '@opentelemetry/semantic-conventions': 1.36.0
- '@sindresorhus/slugify': 2.2.1
- date-fns: 3.6.0
- dotenv: 16.6.1
- hono: 4.9.7
- js-tiktoken: 1.0.20
- json-schema: 0.4.0
- json-schema-to-zod: 2.6.1
- p-map: 7.0.3
- pino: 9.7.0
- pino-pretty: 13.0.0
- radash: 12.1.1
- sift: 17.1.3
- xstate: 5.20.2
- zod: 4.1.9
- zod-to-json-schema: 3.24.6([email protected])
- transitivePeerDependencies:
- - '@hono/arktype-validator'
- - '@hono/effect-validator'
- - '@hono/typebox-validator'
- - '@hono/valibot-validator'
- - '@hono/zod-validator'
- - '@sinclair/typebox'
- - '@valibot/to-json-schema'
- - arktype
- - effect
- - encoding
- - openapi-types
- - react
- - supports-color
- - valibot
- - zod-openapi
-
dependencies:
'@apidevtools/json-schema-ref-parser': 14.2.1(@types/[email protected])
@@ -8215,22 +8140,6 @@ snapshots:
- '@types/json-schema'
- supports-color
- dependencies:
- '@apidevtools/json-schema-ref-parser': 14.2.1(@types/[email protected])
- '@modelcontextprotocol/sdk': 1.18.0
- date-fns: 4.1.0
- exit-hook: 4.0.0
- fast-deep-equal: 3.1.3
- uuid: 11.1.0
- zod: 4.1.9
- zod-from-json-schema: 0.5.0
- zod-from-json-schema-v3: [email protected]
- transitivePeerDependencies:
- - '@types/json-schema'
- - supports-color
-
dependencies:
@@ -8240,15 +8149,6 @@ snapshots:
zod-from-json-schema-v3: [email protected]
zod-to-json-schema: 3.24.6([email protected])
- dependencies:
- json-schema: 0.4.0
- zod: 4.1.9
- zod-from-json-schema: 0.5.0
- zod-from-json-schema-v3: [email protected]
- zod-to-json-schema: 3.24.6([email protected])
-
'@modelcontextprotocol/[email protected]':
dependencies:
ajv: 6.12.6
@@ -9630,14 +9530,6 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
- dependencies:
- '@vitest/spy': 3.2.4
- estree-walker: 3.0.3
- magic-string: 0.30.17
- optionalDependencies:
-
dependencies:
'@vitest/spy': 3.2.4
@@ -9646,22 +9538,6 @@ snapshots:
optionalDependencies:
- dependencies:
- '@vitest/spy': 3.2.4
- estree-walker: 3.0.3
- magic-string: 0.30.17
- optionalDependencies:
-
- dependencies:
- '@vitest/spy': 3.2.4
- estree-walker: 3.0.3
- magic-string: 0.30.17
- optionalDependencies:
-
'@vitest/[email protected]':
dependencies:
tinyrainbow: 2.0.0
@@ -9691,7 +9567,7 @@ snapshots:
sirv: 3.0.1
tinyglobby: 0.2.14
tinyrainbow: 2.0.0
'@vitest/[email protected]':
dependencies:
@@ -9745,18 +9621,6 @@ snapshots:
optionalDependencies:
react: 18.3.1
- dependencies:
- '@ai-sdk/provider': 1.1.3
- '@ai-sdk/provider-utils': 2.2.8([email protected])
- '@ai-sdk/react': 1.2.12([email protected])([email protected])
- '@ai-sdk/ui-utils': 1.2.11([email protected])
- '@opentelemetry/api': 1.9.0
- jsondiffpatch: 0.6.0
- zod: 4.1.9
- optionalDependencies:
- react: 18.3.1
-
dependencies:
'@ai-sdk/gateway': 1.0.15([email protected])
@@ -9765,14 +9629,6 @@ snapshots:
'@opentelemetry/api': 1.9.0
zod: 3.25.76
- dependencies:
- '@ai-sdk/gateway': 1.0.15([email protected])
- '@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.7([email protected])
- '@opentelemetry/api': 1.9.0
- zod: 4.1.9
-
dependencies:
'@ai-sdk/gateway': 1.0.23([email protected])
@@ -9781,14 +9637,6 @@ snapshots:
'@opentelemetry/api': 1.9.0
zod: 3.25.76
- dependencies:
- '@ai-sdk/gateway': 1.0.23([email protected])
- '@ai-sdk/provider': 2.0.0
- '@ai-sdk/provider-utils': 3.0.9([email protected])
- '@opentelemetry/api': 1.9.0
- zod: 4.1.9
-
dependencies:
fast-deep-equal: 3.1.3
@@ -10117,7 +9965,7 @@ snapshots:
resolve-package-path: 4.0.3
uuid: 10.0.0
zod: 3.25.76
- zod-to-json-schema: 3.24.5([email protected])
+ zod-to-json-schema: 3.24.6([email protected])
transitivePeerDependencies:
- debug
@@ -10937,15 +10785,6 @@ snapshots:
hono: 4.9.7
zod: 3.25.76
- dependencies:
- json-schema-walker: 2.0.0
- openapi-types: 12.1.3
- optionalDependencies:
- effect: 3.16.16
- hono: 4.9.7
- zod: 4.1.9
-
@@ -11233,7 +11072,7 @@ snapshots:
optionalDependencies:
dependencies:
'@types/uuid': 10.0.0
chalk: 4.1.2
@@ -11299,12 +11138,12 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 9.0.0
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
'@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
- '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected])([email protected])([email protected])([email protected])([email protected])
'@types/lodash': 4.17.20
'@types/node': 24.6.2
lodash: 4.17.21
@@ -11321,12 +11160,12 @@ snapshots:
- web-tree-sitter
- zod
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
'@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
- '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])
+ '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])
'@types/lodash': 4.17.20
'@types/node': 24.6.2
lodash: 4.17.21
@@ -11663,10 +11502,10 @@ snapshots:
ws: 8.18.2
zod: 3.25.76
optionalDependencies:
ws: 8.18.2
- zod: 4.1.9
+ zod: 3.25.76
optionalDependencies:
@@ -12954,7 +12793,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -13038,7 +12877,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -13080,7 +12919,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -13271,28 +13110,20 @@ snapshots:
dependencies:
- zod: 4.1.9
+ zod: 4.1.12
dependencies:
zod: 3.25.76
- dependencies:
- zod: 4.1.9
-
dependencies:
zod: 3.25.76
- dependencies:
- zod: 4.1.9
-
diff --git a/ts/examples/tools/package.json b/ts/examples/tools/package.json
index 9cc5b2dd6..06fdc4811 100644
--- a/ts/examples/tools/package.json
+++ b/ts/examples/tools/package.json
@@ -21,6 +21,7 @@
"@composio/core": "workspace:*",
"dotenv": "^16.4.1",
"openai": "^5.19.1",
+ "zod": "catalog:",
"zod-to-json-schema": "^3.24.5"
},
"devDependencies": {
diff --git a/ts/examples/tools/src/tool-conversion.ts b/ts/examples/tools/src/tool-conversion.ts
index 2bc04ab65..4087d93b1 100644
--- a/ts/examples/tools/src/tool-conversion.ts
+++ b/ts/examples/tools/src/tool-conversion.ts
@@ -1,12 +1,11 @@
import { Composio, jsonSchemaToZodSchema } from '@composio/core';
-import { nullable, z } from 'zod';
import zodToJsonSchema from 'zod-to-json-schema';
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
});
-const tool = await composio.tools.getRawComposioToolBySlug('SLACK_SEND_MESSAGE');
+const tool = await composio.tools.getRawComposioToolBySlug('HUBSPOT_CREATE_LINE_ITEMS');
const inputParams = tool.inputParameters;
console.log(`---------- Original Input Parameters ----------`);
console.log(JSON.stringify(inputParams, null, 2));
diff --git a/ts/examples/vercel/package.json b/ts/examples/vercel/package.json
index 1078e254b..c634b13f2 100644
--- a/ts/examples/vercel/package.json
+++ b/ts/examples/vercel/package.json
@@ -20,7 +20,8 @@
"@composio/vercel": "workspace:*",
"@modelcontextprotocol/sdk": "^1.18.0",
"ai": "catalog:",
- "dotenv": "^16.5.0"
+ "dotenv": "^16.5.0",
+ "zod-to-json-schema": "^3.24.6"
},
"devDependencies": {
"@types/bun": "^1.2.9",
diff --git a/ts/examples/vercel/src/index.ts b/ts/examples/vercel/src/index.ts
index 42c880885..f5841b7aa 100644
--- a/ts/examples/vercel/src/index.ts
+++ b/ts/examples/vercel/src/index.ts
@@ -19,7 +19,7 @@ const composio = new Composio({
* Alternatively, you can use the `composio.getToolBySlug` method
*/
async function run() {
- const tools = await composio.tools.get('test-user-id', 'HACKERNEWS_GET_FRONTPAGE', {
+ const tools = await composio.tools.get('test-user-id', 'HUBSPOT_CREATE_LINE_ITEMS', {
beforeExecute: ({ params, toolSlug }) => {
console.log(`🔄 Executing ${toolSlug} with params:`, { params });
return params;
@@ -33,12 +33,14 @@ async function run() {
const messages: ModelMessage[] = [
{
role: MessageRoles.USER,
- content: 'Summarize the front page of HackerNews',
+ content: 'What tools do you have access to?',
},
];
+ // const schema = tools[0].inputSchema;
+
const { text } = await generateText({
- model: openai('gpt-4o-mini'),
+ model: openai.responses('gpt-4.1'),
tools: tools,
messages,
stopWhen: stepCountIs(5),
diff --git a/ts/packages/core/package.json b/ts/packages/core/package.json
index 6c3553a90..83d7296c7 100644
--- a/ts/packages/core/package.json
+++ b/ts/packages/core/package.json
@@ -45,7 +45,7 @@
"zod": "catalog:"
},
"peerDependencies": {
- "zod": "3.25.76"
+ "zod": ">=3.25.76 <5"
},
"dependencies": {
"@composio/client": "catalog:",
diff --git a/ts/packages/core/src/errors/ComposioError.ts b/ts/packages/core/src/errors/ComposioError.ts
index f0ce7b750..603269a47 100644
--- a/ts/packages/core/src/errors/ComposioError.ts
+++ b/ts/packages/core/src/errors/ComposioError.ts
@@ -9,7 +9,7 @@
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error}
*/
import chalk from 'chalk';
-import { ZodError } from 'zod';
+import { ZodError } from 'zod/v3';
import { BadRequestError } from '@composio/client';
import logger from '../utils/logger';
diff --git a/ts/packages/core/src/errors/ValidationErrors.ts b/ts/packages/core/src/errors/ValidationErrors.ts
index a5225b821..5386ebaa0 100644
--- a/ts/packages/core/src/errors/ValidationErrors.ts
+++ b/ts/packages/core/src/errors/ValidationErrors.ts
@@ -1,6 +1,6 @@
// packages/core/src/errors/ValidationError.ts
-import { ZodError } from 'zod';
+import { ZodError } from 'zod/v3';
import { ComposioError, ComposioErrorOptions } from './ComposioError';
/**
diff --git a/ts/packages/core/src/services/internal/InternalService.types.ts b/ts/packages/core/src/services/internal/InternalService.types.ts
index c89b613e3..4fa8fd9d7 100644
--- a/ts/packages/core/src/services/internal/InternalService.types.ts
+++ b/ts/packages/core/src/services/internal/InternalService.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
export interface ComposioSDKRealtimeCredentialsResponse {
pusher_key: string;
diff --git a/ts/packages/core/src/services/telemetry/TelemetryService.types.ts b/ts/packages/core/src/services/telemetry/TelemetryService.types.ts
index 17885adef..7a9342d52 100644
--- a/ts/packages/core/src/services/telemetry/TelemetryService.types.ts
+++ b/ts/packages/core/src/services/telemetry/TelemetryService.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
export const TelemetryMetricSourceSchema = z.object({
host: z
diff --git a/ts/packages/core/src/types/authConfigs.types.ts b/ts/packages/core/src/types/authConfigs.types.ts
index 0060f94b1..9aafe94b0 100644
--- a/ts/packages/core/src/types/authConfigs.types.ts
+++ b/ts/packages/core/src/types/authConfigs.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
export const AuthConfigTypes = {
CUSTOM: 'use_custom_auth',
diff --git a/ts/packages/core/src/types/connectedAccountAuthStates.types.ts b/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
index a23305af0..62bbddd4b 100644
--- a/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
+++ b/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { AuthSchemeTypes } from './authConfigs.types';
export const ConnectionStatuses = {
diff --git a/ts/packages/core/src/types/connectedAccounts.types.ts b/ts/packages/core/src/types/connectedAccounts.types.ts
index 45242425e..ed5a31a92 100644
--- a/ts/packages/core/src/types/connectedAccounts.types.ts
+++ b/ts/packages/core/src/types/connectedAccounts.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { ConnectionDataSchema } from './connectedAccountAuthStates.types';
/**
diff --git a/ts/packages/core/src/types/customTool.types.ts b/ts/packages/core/src/types/customTool.types.ts
index 95d5bb2c5..074b1ed29 100644
--- a/ts/packages/core/src/types/customTool.types.ts
+++ b/ts/packages/core/src/types/customTool.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { Tool, ToolProxyParams } from './tool.types';
import { ToolExecuteResponse } from '@composio/client/resources/tools';
import { ConnectionData } from './connectedAccountAuthStates.types';
diff --git a/ts/packages/core/src/types/mcp.experimental.types.ts b/ts/packages/core/src/types/mcp.experimental.types.ts
index 2e3b2121d..4cd8b396f 100644
--- a/ts/packages/core/src/types/mcp.experimental.types.ts
+++ b/ts/packages/core/src/types/mcp.experimental.types.ts
@@ -1,4 +1,4 @@
-import z from 'zod';
+import z from 'zod/v3';
export const MCPServerInstanceSchema = z.object({
id: z.string(),
diff --git a/ts/packages/core/src/types/mcp.types.ts b/ts/packages/core/src/types/mcp.types.ts
index ed92b4682..465e833ff 100644
--- a/ts/packages/core/src/types/mcp.types.ts
+++ b/ts/packages/core/src/types/mcp.types.ts
@@ -3,7 +3,7 @@ import {
McpCreateResponse as McpCreateResponseRaw,
GenerateURLResponse as GenerateURLResponseRaw,
} from '@composio/client/resources/mcp';
-import { z } from 'zod';
+import { z } from 'zod/v3';
/**
* @deprecated
diff --git a/ts/packages/core/src/types/tool.types.ts b/ts/packages/core/src/types/tool.types.ts
index ed8d97e64..e3b2b6414 100644
--- a/ts/packages/core/src/types/tool.types.ts
+++ b/ts/packages/core/src/types/tool.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { CustomConnectionDataSchema } from './connectedAccountAuthStates.types';
import { TransformToolSchemaModifier } from './modifiers.types';
diff --git a/ts/packages/core/src/types/toolRouter.types.ts b/ts/packages/core/src/types/toolRouter.types.ts
index eb83b5d0e..c5592fe4e 100644
--- a/ts/packages/core/src/types/toolRouter.types.ts
+++ b/ts/packages/core/src/types/toolRouter.types.ts
@@ -1,4 +1,4 @@
-import z from 'zod';
+import z from 'zod/v3';
export const ToolRouterToolkitConfigSchema = z.object({
toolkit: z.string(),
diff --git a/ts/packages/core/src/types/toolkit.types.ts b/ts/packages/core/src/types/toolkit.types.ts
index 7be118ae8..86c4c5e62 100644
--- a/ts/packages/core/src/types/toolkit.types.ts
+++ b/ts/packages/core/src/types/toolkit.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { AuthSchemeEnum } from './authConfigs.types';
/**
diff --git a/ts/packages/core/src/types/triggers.types.ts b/ts/packages/core/src/types/triggers.types.ts
index 7f29a550c..9c4505791 100644
--- a/ts/packages/core/src/types/triggers.types.ts
+++ b/ts/packages/core/src/types/triggers.types.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
export const TriggerStatuses = {
ENABLE: 'enable',
diff --git a/ts/packages/core/src/utils/jsonSchema.ts b/ts/packages/core/src/utils/jsonSchema.ts
index dc7421e4d..807be25f2 100644
--- a/ts/packages/core/src/utils/jsonSchema.ts
+++ b/ts/packages/core/src/utils/jsonSchema.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { JsonSchemaToZodError } from '../errors';
import { jsonSchemaToZod } from '@composio/json-schema-to-zod';
diff --git a/ts/packages/core/src/utils/transform.ts b/ts/packages/core/src/utils/transform.ts
index d88bf83cc..9f0d2020a 100644
--- a/ts/packages/core/src/utils/transform.ts
+++ b/ts/packages/core/src/utils/transform.ts
@@ -11,7 +11,7 @@
* .using((raw) => ({ ... }))
* ```
*/
-import { ZodTypeAny, z } from 'zod';
+import { ZodTypeAny, z } from 'zod/v3';
import { ValidationError } from '../errors';
import { logger } from '..';
diff --git a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
index 8c0da3585..39203c4f3 100644
--- a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
+++ b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { AuthConfigs } from '../../src/models/AuthConfigs';
import ComposioClient from '@composio/client';
import { ValidationError } from '../../src/errors/ValidationErrors';
-import { ZodError } from 'zod';
+import { ZodError } from 'zod/v3';
import {
AuthConfigRetrieveResponse as ComposioAuthConfigRetrieveResponse,
AuthConfigDeleteResponse,
diff --git a/ts/packages/core/test/tools/customTools.test.ts b/ts/packages/core/test/tools/customTools.test.ts
index 386167148..e791efe36 100644
--- a/ts/packages/core/test/tools/customTools.test.ts
+++ b/ts/packages/core/test/tools/customTools.test.ts
@@ -3,7 +3,7 @@ import { CustomTools } from '../../src/models/CustomTools';
import { mockClient } from '../utils/mocks/client.mock';
import { toolMocks } from '../utils/mocks/data.mock';
import ComposioClient from '@composio/client';
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { ComposioToolNotFoundError } from '../../src/errors/ToolErrors';
import { ComposioConnectedAccountNotFoundError } from '../../src/errors/ConnectedAccountsErrors';
import { ValidationError } from '../../src/errors';
diff --git a/ts/packages/core/test/utils/mocks/data.mock.ts b/ts/packages/core/test/utils/mocks/data.mock.ts
index d3fc8ad01..2e4e6984c 100644
--- a/ts/packages/core/test/utils/mocks/data.mock.ts
+++ b/ts/packages/core/test/utils/mocks/data.mock.ts
@@ -1,5 +1,3 @@
-import { z } from 'zod';
-
export const toolMocks = {
rawTool: {
slug: 'COMPOSIO_TOOL',
diff --git a/ts/packages/json-schema-to-zod/package.json b/ts/packages/json-schema-to-zod/package.json
index 945cedbc2..e7f849746 100644
--- a/ts/packages/json-schema-to-zod/package.json
+++ b/ts/packages/json-schema-to-zod/package.json
@@ -39,6 +39,6 @@
"zod": "catalog:"
},
"peerDependencies": {
- "zod": "3.25.76"
+ "zod": ">=3.25.76 <5"
}
}
diff --git a/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts b/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts
index c747f41c6..2542ef61b 100644
--- a/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts
+++ b/ts/packages/json-schema-to-zod/src/json-schema-to-zod.ts
@@ -1,4 +1,4 @@
-import type { z } from 'zod';
+import type { z } from 'zod/v3';
import { parseSchema } from './parsers/parse-schema';
import type { JsonSchemaToZodOptions, JsonSchema } from './types';
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts
index be8fd2c7e..7610cde15 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-all-of.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
@@ -7,40 +7,40 @@ import { half } from '../utils/half';
const originalIndex = Symbol('Original index');
const ensureOriginalIndex = (arr: JsonSchema[]) => {
- const newArr = [];
-
- for (let i = 0; i < arr.length; i++) {
- const item = arr[i];
- if (typeof item === 'boolean') {
- newArr.push(item ? { [originalIndex]: i } : { [originalIndex]: i, not: {} });
- } else if (originalIndex in item) {
- return arr;
- } else {
- newArr.push({ ...item, [originalIndex]: i });
- }
- }
-
- return newArr;
+ const newArr = [];
+
+ for (let i = 0; i < arr.length; i++) {
+ const item = arr[i];
+ if (typeof item === 'boolean') {
+ newArr.push(item ? { [originalIndex]: i } : { [originalIndex]: i, not: {} });
+ } else if (originalIndex in item) {
+ return arr;
+ } else {
+ newArr.push({ ...item, [originalIndex]: i });
+ }
+ }
+
+ return newArr;
};
export function parseAllOf(
- jsonSchema: JsonSchemaObject & { allOf: JsonSchema[] },
- refs: Refs,
+ jsonSchema: JsonSchemaObject & { allOf: JsonSchema[] },
+ refs: Refs
): z.ZodTypeAny {
- if (jsonSchema.allOf.length === 0) {
- return z.never();
- }
+ if (jsonSchema.allOf.length === 0) {
+ return z.never();
+ }
- if (jsonSchema.allOf.length === 1) {
- const item = jsonSchema.allOf[0];
+ if (jsonSchema.allOf.length === 1) {
+ const item = jsonSchema.allOf[0];
- return parseSchema(item, {
- ...refs,
- path: [...refs.path, 'allOf', (item as never)[originalIndex]],
- });
- }
+ return parseSchema(item, {
+ ...refs,
+ path: [...refs.path, 'allOf', (item as never)[originalIndex]],
+ });
+ }
- const [left, right] = half(ensureOriginalIndex(jsonSchema.allOf));
+ const [left, right] = half(ensureOriginalIndex(jsonSchema.allOf));
- return z.intersection(parseAllOf({ allOf: left }, refs), parseAllOf({ allOf: right }, refs));
+ return z.intersection(parseAllOf({ allOf: left }, refs), parseAllOf({ allOf: right }, refs));
}
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-any-of.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-any-of.ts
index 73b19b173..2ae13a992 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-any-of.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-any-of.ts
@@ -1,19 +1,19 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
export const parseAnyOf = (jsonSchema: JsonSchemaObject & { anyOf: JsonSchema[] }, refs: Refs) => {
- return jsonSchema.anyOf.length
- ? jsonSchema.anyOf.length === 1
- ? parseSchema(jsonSchema.anyOf[0], {
- ...refs,
- path: [...refs.path, 'anyOf', 0],
- })
- : z.union(
- jsonSchema.anyOf.map((schema, i) =>
- parseSchema(schema, { ...refs, path: [...refs.path, 'anyOf', i] }),
- ) as [z.ZodTypeAny, z.ZodTypeAny],
- )
- : z.any();
+ return jsonSchema.anyOf.length
+ ? jsonSchema.anyOf.length === 1
+ ? parseSchema(jsonSchema.anyOf[0], {
+ ...refs,
+ path: [...refs.path, 'anyOf', 0],
+ })
+ : z.union(
+ jsonSchema.anyOf.map((schema, i) =>
+ parseSchema(schema, { ...refs, path: [...refs.path, 'anyOf', i] })
+ ) as [z.ZodTypeAny, z.ZodTypeAny]
+ )
+ : z.any();
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts
index 1164fd6ec..f2cb9e4c2 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-array.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, Refs, JsonSchema } from '../types';
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-boolean.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-boolean.ts
index be8e309e4..39f7376ad 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-boolean.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-boolean.ts
@@ -1,7 +1,7 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
export const parseBoolean = (_jsonSchema: JsonSchemaObject & { type: 'boolean' }) => {
- return z.boolean();
+ return z.boolean();
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts
index 445523652..374e3f451 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-const.ts
@@ -1,7 +1,7 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject, Serializable } from '../types';
export const parseConst = (jsonSchema: JsonSchemaObject & { const: Serializable }) => {
- return z.literal(jsonSchema.const as z.Primitive);
+ return z.literal(jsonSchema.const as z.Primitive);
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-default.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-default.ts
index d64bcf85c..1899d3800 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-default.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-default.ts
@@ -1,7 +1,7 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
export const parseDefault = (_jsonSchema: JsonSchemaObject) => {
- return z.any();
+ return z.any();
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts
index 26385472c..26975bc86 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-enum.ts
@@ -1,25 +1,22 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject, Serializable } from '../types';
export const parseEnum = (jsonSchema: JsonSchemaObject & { enum: Serializable[] }) => {
- if (jsonSchema.enum.length === 0) {
- return z.never();
- }
+ if (jsonSchema.enum.length === 0) {
+ return z.never();
+ }
- if (jsonSchema.enum.length === 1) {
- // union does not work when there is only one element
- return z.literal(jsonSchema.enum[0] as z.Primitive);
- }
+ if (jsonSchema.enum.length === 1) {
+ // union does not work when there is only one element
+ return z.literal(jsonSchema.enum[0] as z.Primitive);
+ }
- if (jsonSchema.enum.every((x) => typeof x === 'string')) {
- return z.enum(jsonSchema.enum as [string]);
- }
+ if (jsonSchema.enum.every(x => typeof x === 'string')) {
+ return z.enum(jsonSchema.enum as [string]);
+ }
- return z.union(
- jsonSchema.enum.map((x) => z.literal(x as z.Primitive)) as unknown as [
- z.ZodTypeAny,
- z.ZodTypeAny,
- ],
- );
+ return z.union(
+ jsonSchema.enum.map(x => z.literal(x as z.Primitive)) as unknown as [z.ZodTypeAny, z.ZodTypeAny]
+ );
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-if-then-else.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-if-then-else.ts
index 96542f3d7..c89f48531 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-if-then-else.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-if-then-else.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-multiple-type.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-multiple-type.ts
index 65ff3c35b..577cb625d 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-multiple-type.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-multiple-type.ts
@@ -1,16 +1,16 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchema, JsonSchemaObject, Refs } from '../types';
export const parseMultipleType = (
- jsonSchema: JsonSchemaObject & { type: string[] },
- refs: Refs,
+ jsonSchema: JsonSchemaObject & { type: string[] },
+ refs: Refs
) => {
- return z.union(
- jsonSchema.type.map((type) => parseSchema({ ...jsonSchema, type } as JsonSchema, refs)) as [
- z.ZodTypeAny,
- z.ZodTypeAny,
- ],
- );
+ return z.union(
+ jsonSchema.type.map(type => parseSchema({ ...jsonSchema, type } as JsonSchema, refs)) as [
+ z.ZodTypeAny,
+ z.ZodTypeAny,
+ ]
+ );
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-not.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-not.ts
index 219d32c8d..d7b7e5245 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-not.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-not.ts
@@ -1,15 +1,15 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
export const parseNot = (jsonSchema: JsonSchemaObject & { not: JsonSchema }, refs: Refs) => {
- return z.any().refine(
- (value) =>
- !parseSchema(jsonSchema.not, {
- ...refs,
- path: [...refs.path, 'not'],
- }).safeParse(value).success,
- 'Invalid input: Should NOT be valid against schema',
- );
+ return z.any().refine(
+ value =>
+ !parseSchema(jsonSchema.not, {
+ ...refs,
+ path: [...refs.path, 'not'],
+ }).safeParse(value).success,
+ 'Invalid input: Should NOT be valid against schema'
+ );
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-null.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-null.ts
index 86dbfea43..1afe837d3 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-null.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-null.ts
@@ -1,7 +1,7 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
export const parseNull = (_jsonSchema: JsonSchemaObject & { type: 'null' }) => {
- return z.null();
+ return z.null();
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts
index dc4d12e84..dd37aff75 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-number.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
import { extendSchemaWithMessage } from '../utils/extend-schema';
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-object.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-object.ts
index 7aaf0e0db..b15db2558 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-object.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-object.ts
@@ -1,4 +1,4 @@
-import * as z from 'zod';
+import * as z from 'zod/v3';
import { parseAllOf } from './parse-all-of';
import { parseAnyOf } from './parse-any-of';
@@ -9,7 +9,8 @@ import { its } from '../utils/its';
function parseObjectProperties(objectSchema: JsonSchemaObject & { type: 'object' }, refs: Refs) {
if (!objectSchema.properties) {
- return undefined;
+ // leave it as an empty object or else this will break openai responses
+ return z.object({});
}
const propertyKeys = Object.keys(objectSchema.properties);
@@ -187,17 +188,11 @@ export function parseObject(
// When additionalProperties was explicitly true, use passthrough
output = propertiesSchema.passthrough();
} else {
- // Check if propertiesSchema is an empty object
- const isEmptyObject = Object.keys(propertiesSchema._def.shape()).length === 0;
- if (isEmptyObject) {
- output = propertiesSchema.passthrough();
- } else {
- output = propertiesSchema.catchall(additionalProperties);
- }
+ output = propertiesSchema.catchall(additionalProperties);
}
} else {
- // When additionalProperties is not specified, treat it as true
- output = propertiesSchema.passthrough();
+ // When additionalProperties is not specified, treat it as false
+ output = propertiesSchema.strict();
}
} else {
if (hasPatternProperties) {
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-one-of.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-one-of.ts
index 10931a967..e1052a206 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-one-of.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-one-of.ts
@@ -1,41 +1,41 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';
export const parseOneOf = (jsonSchema: JsonSchemaObject & { oneOf: JsonSchema[] }, refs: Refs) => {
- if (!jsonSchema.oneOf.length) {
- return z.any();
- }
+ if (!jsonSchema.oneOf.length) {
+ return z.any();
+ }
- if (jsonSchema.oneOf.length === 1) {
- return parseSchema(jsonSchema.oneOf[0], {
- ...refs,
- path: [...refs.path, 'oneOf', 0],
- });
- }
+ if (jsonSchema.oneOf.length === 1) {
+ return parseSchema(jsonSchema.oneOf[0], {
+ ...refs,
+ path: [...refs.path, 'oneOf', 0],
+ });
+ }
- return z.any().superRefine((x, ctx) => {
- const schemas = jsonSchema.oneOf.map((schema, i) =>
- parseSchema(schema, {
- ...refs,
- path: [...refs.path, 'oneOf', i],
- }),
- );
+ return z.any().superRefine((x, ctx) => {
+ const schemas = jsonSchema.oneOf.map((schema, i) =>
+ parseSchema(schema, {
+ ...refs,
+ path: [...refs.path, 'oneOf', i],
+ })
+ );
- const unionErrors = schemas.reduce<z.ZodError[]>(
- (errors, schema) =>
- ((result) => (result.error ? [...errors, result.error] : errors))(schema.safeParse(x)),
- [],
- );
+ const unionErrors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ (result => (result.error ? [...errors, result.error] : errors))(schema.safeParse(x)),
+ []
+ );
- if (schemas.length - unionErrors.length !== 1) {
- ctx.addIssue({
- path: ctx.path,
- code: 'invalid_union',
- unionErrors,
- message: 'Invalid input: Should pass single schema',
- });
- }
- });
+ if (schemas.length - unionErrors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ });
};
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts
index 8396409cd..9603c32b0 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-schema.ts
@@ -1,4 +1,4 @@
-import * as z from 'zod';
+import * as z from 'zod/v3';
import { parseAllOf } from './parse-all-of';
import { parseAnyOf } from './parse-any-of';
diff --git a/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts b/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts
index f31a1abba..369130de8 100644
--- a/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts
+++ b/ts/packages/json-schema-to-zod/src/parsers/parse-string.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod';
+import { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
import { extendSchemaWithMessage } from '../utils/extend-schema';
diff --git a/ts/packages/json-schema-to-zod/src/types.ts b/ts/packages/json-schema-to-zod/src/types.ts
index 63a467bed..bbbced698 100644
--- a/ts/packages/json-schema-to-zod/src/types.ts
+++ b/ts/packages/json-schema-to-zod/src/types.ts
@@ -1,4 +1,4 @@
-import type { ZodTypeAny } from 'zod';
+import type { ZodTypeAny } from 'zod/v3';
import type { JSONSchema7 } from 'json-schema';
export type Serializable =
diff --git a/ts/packages/json-schema-to-zod/src/utils/extend-schema.ts b/ts/packages/json-schema-to-zod/src/utils/extend-schema.ts
index 718568572..6cc2b126a 100644
--- a/ts/packages/json-schema-to-zod/src/utils/extend-schema.ts
+++ b/ts/packages/json-schema-to-zod/src/utils/extend-schema.ts
@@ -1,4 +1,4 @@
-import type { z } from 'zod';
+import type { z } from 'zod/v3';
import type { JsonSchemaObject } from '../types';
diff --git a/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts b/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts
index 9e2dda382..2d27c53f1 100644
--- a/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts
+++ b/ts/packages/json-schema-to-zod/test/json-to-zod.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { z } from 'zod';
+import { z } from 'zod/v3';
import zodToJsonSchema from 'zod-to-json-schema';
import { jsonSchemaToZod } from '../src/json-schema-to-zod';
import type { JsonSchema } from '../src/types';
@@ -292,7 +292,7 @@ describe('jsonSchemaToZod', () => {
).toThrow();
});
- it('should allow any additional properties when additionalProperties is not specified', () => {
+ it('should reject additional properties when additionalProperties is not specified', () => {
const schema: JsonSchema = {
type: 'object',
properties: {
@@ -301,10 +301,7 @@ describe('jsonSchemaToZod', () => {
};
const zodSchema = jsonSchemaToZod(schema);
expect(zodSchema.parse({ name: 'John' })).toEqual({ name: 'John' });
- expect(zodSchema.parse({ name: 'John', extra: 'field' })).toEqual({
- name: 'John',
- extra: 'field',
- });
+ expect(() => zodSchema.parse({ name: 'John', extra: 'field' })).toThrow();
});
it('should handle additionalProperties with patternProperties', () => {
@@ -1289,7 +1286,7 @@ describe('jsonSchemaToZod', () => {
count: { type: 'number' },
},
required: ['value'],
- additionalProperties: true,
+ additionalProperties: false,
});
// Test parsing behavior
@@ -1309,13 +1306,13 @@ describe('jsonSchemaToZod', () => {
const zodSchema = jsonSchemaToZod(schema);
const convertedBack = zodToJsonSchema(zodSchema, { target: 'jsonSchema7' }) as any;
- // When additionalProperties is undefined, it should default to true behavior
- expect(convertedBack.additionalProperties).toBe(true);
+ // When additionalProperties is undefined, it should default to false behavior (strict)
+ expect(convertedBack.additionalProperties).toBe(false);
expect(convertedBack.type).toBe('object');
- // Test parsing behavior - should allow any additional properties
+ // Test parsing behavior - should reject additional properties
expect(zodSchema.parse({})).toEqual({});
- expect(zodSchema.parse({ any: 'value', number: 123 })).toEqual({ any: 'value', number: 123 });
+ expect(() => zodSchema.parse({ any: 'value', number: 123 })).toThrow();
});
it('should handle objects with properties and additionalProperties undefined (default behavior)', () => {
@@ -1329,16 +1326,13 @@ describe('jsonSchemaToZod', () => {
const zodSchema = jsonSchemaToZod(schema);
const convertedBack = zodToJsonSchema(zodSchema, { target: 'jsonSchema7' }) as any;
- // When additionalProperties is undefined, it should default to true behavior
- expect(convertedBack.additionalProperties).toBe(true);
+ // When additionalProperties is undefined, it should default to false behavior (strict)
+ expect(convertedBack.additionalProperties).toBe(false);
expect(convertedBack.properties).toBeDefined();
- // Test parsing behavior - should allow any additional properties
+ // Test parsing behavior - should reject additional properties
expect(zodSchema.parse({ name: 'John' })).toEqual({ name: 'John' });
- expect(zodSchema.parse({ name: 'John', extra: 'field' })).toEqual({
- name: 'John',
- extra: 'field',
- });
+ expect(() => zodSchema.parse({ name: 'John', extra: 'field' })).toThrow();
});
it('should handle nested objects with different additionalProperties settings', () => {