Skip to content

Feature Request: Support Zod 4.x #3951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
alexbaileyxplor opened this issue May 21, 2025 · 4 comments
Open
1 of 2 tasks

Feature Request: Support Zod 4.x #3951

alexbaileyxplor opened this issue May 21, 2025 · 4 comments
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision parser This item relates to the Parser Utility

Comments

@alexbaileyxplor
Copy link

Summary

Zod 4 is stable and available to use today (https://zod.dev/v4). It comes with a range of improvements which I won't reiterate here.

Why is this needed?

  • Significant performance improvements have been benchmarked should reduce costs for people running with the Parser component.
  • 2x reduction in core bundle size should lead to reduced Lambda function packages.
  • Multiple new features and a significantly improved API.

Which area does this relate to?

Parser

Solution

Update to Zod 4 for Parser. On the surface, it looks like many API's are backwards compatible. See https://zod.dev/v4/changelog for full migration guide. Most changes also seem to be deprecated rather than backwards breaking.

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@alexbaileyxplor alexbaileyxplor added triage This item has not been triaged by a maintainer, please wait internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels May 21, 2025
Copy link

boring-cyborg bot commented May 21, 2025

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@dreamorosi dreamorosi changed the title Maintenance: Support Zod 4 Feature REquest: Support Zod 4.x May 21, 2025
@dreamorosi dreamorosi changed the title Feature REquest: Support Zod 4.x Feature Request: Support Zod 4.x May 21, 2025
@dreamorosi dreamorosi added feature-request This item refers to a feature request for an existing or new utility parser This item relates to the Parser Utility need-customer-feedback Requires more customers feedback before making or revisiting a decision and removed internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) triage This item has not been triaged by a maintainer, please wait labels May 21, 2025
@dreamorosi
Copy link
Contributor

We've been looking into supporting the new major version and from our side, especially when it comes to built-in schemas we ship, the changes are doable relatively easily.

The main question I'd like to hear from customers/users of our Parser library is whether they'd be ok with us forcing them into upgrading Zod.

Even by ignoring the fact that if we were to be strict about semantic versioning this upgrade would require us to release a major version, Zod's own author seems to have acknowledged that migrating from v3 to v4 might require some time, especially for end customers.

In short, if customers are already using v3 with/without Parser, us upgrading to v4 would break them and force them to upgrade as well, or have two copies of Zod in their bundle, which is not advisable.

From our side we'll make all the steps necessary to migrate, like upgrading our TypeScript configs to be able to leverage the sub-path exports and also upgrade the documentation to specify that for now we support only v3.

I'd like to leave this issue open for a while and hear from customers who are already using Parser, would you prefer us to upgrade to v4 right away or stay on v3 for a while longer?

@alexbaileyxplor
Copy link
Author

@dreamorosi thanks for the update. Personally I'd be totally fine with forcing an update. However, not all customers will be in that position. As an alternative, is it possible to take a similar approach to Zod where we have a separate path to import from for v4? That way we can do the work to upgrade this package now, and then remove the v3 version in a future, breaking change.

@dreamorosi
Copy link
Contributor

As an alternative, is it possible to take a similar approach to Zod where we have a separate path to import from for v4

It's possible, but I don't know if we'll want to go in this direction.

Supporting both would mean duplicating practically the entire codebase under packages/parser/src and packages/parser/tests, as well as potentially a good chunk of the documentation to account for differences.

Zod had good reasons to do this because they have a lot of libraries that depend on them, and for many users Zod is only a transitive dependency. Parser on the other hand is an end-user library, so customers using it can decide whether they want to stay on a version of Parser that supports Zod v3 or upgrade to one that supports v4.

With Zod being the only dependency of Parser is also unlikely that there will be many reasons to want to upgrade Parser beyond new/updated built-in schemas, so in practice we could theoretically upgrade to v4 and let customers who want to stay on v3 continue using that version of Parser.

With that said I'd rather hear from more people and see if we have concerns with migrating to v4 before committing time/resources in creating doubles of all our schemas/envelopes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision parser This item relates to the Parser Utility
Projects
Development

No branches or pull requests

2 participants