Skip to content

fix: replace @dmitryrechkin/json-schema-to-zod with native zod v4 con…#295

Open
veeramarni wants to merge 1 commit intoinngest:mainfrom
reboxjs:fix/custom-zod
Open

fix: replace @dmitryrechkin/json-schema-to-zod with native zod v4 con…#295
veeramarni wants to merge 1 commit intoinngest:mainfrom
reboxjs:fix/custom-zod

Conversation

@veeramarni
Copy link

…verter

Remove the @dmitryrechkin/json-schema-to-zod dependency which requires zod v3 and replace it with a self-contained JSON Schema to Zod converter that works natively with zod v4.

Changes:

  • Remove @dmitryrechkin/json-schema-to-zod from dependencies in package.json
  • Add src/json-schema-to-zod.ts: self-contained converter supporting strings (format, pattern, enum, length), numbers/integers (min/max/multipleOf), booleans, nulls, arrays (items, min/max), objects (required, additionalProperties), combinators (oneOf/anyOf/allOf), nullable types, and type arrays
  • Update src/agent.ts: replace dynamic import of the external package with a direct import of the local jsonSchemaToZod function; removes the as unknown as ZodType cast since it now returns a native zod v4 type
  • Add src/json-schema-to-zod.test.ts: 25 tests covering all conversion scenarios including MCP-style tool input schemas

This eliminates the zod v3/v4 compatibility issue where ZodSchema was renamed to ZodType in zod v4, which was causing runtime errors without patching.

…verter

Remove the @dmitryrechkin/json-schema-to-zod dependency which requires zod v3
and replace it with a self-contained JSON Schema to Zod converter that works
natively with zod v4.

Changes:
- Remove @dmitryrechkin/json-schema-to-zod from dependencies in package.json
- Add src/json-schema-to-zod.ts: self-contained converter supporting strings
  (format, pattern, enum, length), numbers/integers (min/max/multipleOf),
  booleans, nulls, arrays (items, min/max), objects (required,
  additionalProperties), combinators (oneOf/anyOf/allOf), nullable types,
  and type arrays
- Update src/agent.ts: replace dynamic import of the external package with
  a direct import of the local jsonSchemaToZod function; removes the
  `as unknown as ZodType` cast since it now returns a native zod v4 type
- Add src/json-schema-to-zod.test.ts: 25 tests covering all conversion
  scenarios including MCP-style tool input schemas

This eliminates the zod v3/v4 compatibility issue where ZodSchema was renamed
to ZodType in zod v4, which was causing runtime errors without patching.
@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

⚠️ No Changeset found

Latest commit: f6d2cbf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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