Skip to content

Conversation

@sinclairzx81
Copy link

Hello!

This PR includes a TypeBox port for the current Zod protocol types where the protocol structures are modeled using pure JSON Schema representations. These updates are written to make protocol structures directly compatible with Ajv without schema translation.

I have also included a typebox.types.test.ts which implements Ajv and TypeBox versions of the current z.safeParse tests.

Updates

  • added src/typebox/types.ts
  • added src/typebox.spec.types.test.ts
  • added src/typebox.types.test.ts
  • renamed src/spec.types.test.ts src/zod.spec.types.test.ts
  • renamed src/types.test.ts src/zod.types.test.ts

Notes:

TypeBox can generate Zod and TypeScript-aligned JSON Schemas while ensuring that the resulting schematics remain specification-compliant and fully compatible with Ajv.

This PR is not necessarily proposing that the SDK replace Zod with TypeBox (although that is an option), but rather introduces a path for the SDK to achieve internal JSON Schema compliance. Using TypeBox, it would be possible to model protocol types that can be serialized as JSON Schema documents and published alongside the SDK.

This approach would allow the SDK to decouple from external libraries, including TypeBox itself, and rely internally on standardized JSON Schema definitions validated through Ajv.


Submitting for review and consideration

@sinclairzx81 sinclairzx81 marked this pull request as draft October 8, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant