@devries-cameron20 / composio Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 07:15 UTC

next
md 48 lines 2.06 KB
Rendered Raw
1 # json-schema-to-zod + Zod v4 Compatibility Test
2
3 Verifies that `@composio/json-schema-to-zod` works correctly with `zod@4`.
4
5 ## Why This Exists
6
7 The `@composio/json-schema-to-zod` package must support both Zod v3 and v4. This suite ensures:
8
9 - JSON Schema to Zod conversion works with Zod v4
10 - All schema types (string, object, array, anyOf) convert correctly
11 - `additionalProperties` handling works correctly with Zod v4's API
12 - Complex nested structures and union types parse correctly
13
14 ## What It Tests
15
16 | Test | Description |
17 | ---------------------- | ---------------------------------------------------------- |
18 | Basic string schema | Converts `{ type: 'string' }` and validates |
19 | Object schema | Required fields, nested properties, validation constraints |
20 | Array schema | Typed array items with validation |
21 | Email format | Format validation for email strings |
22 | Nested schemas | Complex nested objects and arrays |
23 | anyOf schemas | Union type conversion |
24 | additionalProperties | Strict, passthrough, and typed catchall modes |
25 | Complex nested arrays | Arrays of objects with nested arrays |
26 | Union with constraints | anyOf with minLength, minimum, and required fields |
27 | `/v4` entry | Builds a Zod v4 schema and checks the zod floor it needs |
28
29 ## Test Setup
30
31 This test runs **directly in Bun** (no Docker fixtures). The test file imports `@composio/json-schema-to-zod` from the monorepo workspace:
32
33 ```typescript
34 import { jsonSchemaToZod, type JsonSchema } from '@composio/json-schema-to-zod';
35 import { jsonSchemaToZod as jsonSchemaToZodV4 } from '@composio/json-schema-to-zod/v4';
36 ```
37
38 Tests use `bun:test` assertions to verify schema conversion and parsing behavior.
39
40 ## Isolation Tool
41
42 **Docker** with Node.js versions: 22.23.5, 24.22.3, 26.13.1.
43
44 ## Running
45
46 ```bash
47 pnpm test:e2e
48 ```