-
Notifications
You must be signed in to change notification settings - Fork 69
chore(deps): update zod to v4 #105
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
base: main
Are you sure you want to change the base?
Conversation
|
Warning Rate limit exceeded@renovate[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 24 seconds before requesting another review. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. π¦ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. β Files ignored due to path filters (1)
π Files selected for processing (2)
π WalkthroughWalkthroughBumps the zod dependency from 3.25.76 to 4.1.12 in two packages: packages/blocks and packages/database-integrations. No other code, export, or public API changes were made in this PR. Sequence Diagram(s)(omitted β dependency version upgrade; no control-flow or new feature to diagram) Possibly related PRs
Suggested reviewers
Pre-merge checksβ Passed checks (2 passed)
Comment |
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #105 +/- ##
=======================================
Coverage 95.31% 95.31%
=======================================
Files 26 26
Lines 726 726
Branches 210 207 -3
=======================================
Hits 692 692
Misses 34 34 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
fe55215 to
731f4d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
β Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
π Additional comments (1)
packages/database-integrations/package.json (1)
35-35: No issues found β zod v4 is compatible with this package.The main user-facing breaking change is default handling with
.default().optional(), which this codebase doesn't use. Deprecated methods like.strict()remain available for backwards compatibility. The database-integrations package only contains schema definitions usingz.object(),z.string(),.optional(),.extend(),z.record(), and type inferenceβall fully supported in v4.
1817727 to
2d62ae2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
β Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
π Additional comments (1)
packages/database-integrations/package.json (1)
35-35: Zod v4 appears compatible; confirm tests pass before merging.The package uses only stable zod APIs (z.object, z.string, z.literal, z.optional, z.discriminatedUnion, z.infer, z.ZodSchema) with no deprecated error patterns or .nonstrict() calls. However, run
npm testinpackages/database-integrations/to verify the 100+ .safeParse() calls in the test suite work with v4.1.12.
2d62ae2 to
fad71f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
β Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
π Additional comments (1)
packages/database-integrations/package.json (1)
35-35: No schema changes needed for zod v4 upgrade.Verification found no
z.record()calls in database-integrations. Schemas usez.object()andz.discriminatedUnion()exclusively, which have no breaking changes in zod v4. Safe to proceed.
2954c00 to
1ee42cf
Compare
1ee42cf to
546f302
Compare
This PR contains the following updates:
3.25.76->4.1.12Release Notes
colinhacks/zod (zod)
v4.1.12Compare Source
Commits:
0b109c3docs(ecosystem): add bupkis to the ecosystem section (#β5237)d22ec0ddocs(ecosystem): add upfetch (#β5238)c56a4f6docs(ecosystem): addeslint-plugin-zod-x(#β5261)a0abcc0docs(metadata.mdx): fix a mistake in an example output (#β5248)62bf4e4fix(ZodError): prevent flatten() from crashing on 'toString' key (#β5266)02a5840refac(errors): Unify code structure and improve types (#β5278)4b1922adocs(content/v4/index): fix zod version (#β5289)3fcb20fAdd frrm to ecosystem (#β5292)fda4c7cMake docs work without tokenaf44738Fix lint77c3c9fExport bg.ts3b94610v4.1.12v4.1.11Compare Source
Commits:
2bed4b34.1.11v4.1.10Compare Source
Commits:
7ffedd0Fix shape caching (#β5263)82cd717v4.1.10v4.1.9Compare Source
Commits:
a78716dUpdate zshy (#β5249)923af80Publish zod@β4.1.9v4.1.8Compare Source
Commits:
36c4ee3Switch back to weakmapa1726d54.1.8v4.1.7Compare Source
Commits:
0cca351Fix variable name inconsistency in coercion documentation (#β5188)aa78c27Add copy/edit buttons76452d4Update button txt937f73cFix tsconfig issue in bench976b436v4.1.6 (#β5222)4309c61Fix cidrv6 validation - cidrv6 should reject invalid strings with multiple slashes (#β5196)ef95a73feat(locales): Add Lithuanian (lt) locale (#β5210)3803f3fdocs: update wrong contents in codeblocks inapi.mdx(#β5209)8a47d5cdocs: update coerce example inapi.mdx(#β5207)e87db13feat(locales): Add Georgian (ka) locale (#β5203)c54b123docs: adds@traversable/zodand@traversable/zod-testto v4 ecosystem (#β5194)c27a294Fix two tiny grammatical errors in the docs. (#β5193)23a2d66docs: fix broken links in async refinements and transforms references (#β5190)845a230fix(locales): Add type name translations to Spanish locale (#β5187)27f13d6Improve regex precision and eliminate duplicates in regexes.ts (#β5181)a8a52b3fix(v4): fix Khmer and Ukrainian locales (#β5177)887e37cUpdate slugse1f1948fix(v4): ensure array defaults are shallow-cloned (#β5173)9f65038docs(ecosystem): add DRZL; fix Prisma Zod Generator placement (#β5215)aa6f0f0More fixes (#β5223)aab33564.1.7v4.1.6Compare Source
v4.1.5Compare Source
Commits:
530415fUpdate docsb7b081dUpdate z.function() type to support array input (#β5170)780cf574.1.5v4.1.4Compare Source
Commits:
3291c61fix(v4): toJSONSchema - wrong tuple withnulloutput when targetingopenapi-3.0(#β5156)23f41c7test(v4): toJSONSchema - usevalidateOpenAPI30Schemain all relevant scenarios (#β5163)0a09fd2Update installation instructions4ea5fec4.1.4v4.1.3Compare Source
Commits:
98ff675Drop stringToBooleana410616Fix typo0cf4589fix(v4): toJSONSchema - add missing oneOf inside items in tuple conversion (#β5146)8bf0c16fix(v4): toJSONSchema tuple path handling for draft-7 with metadata IDs (#β5152)5c5fa90fix(v4): toJSONSchema - wrong record output when targetingopenapi-3.0(#β5141)87b97ccdocs(codecs): update example to use payloadSchema (#β5150)309f358fix(v4): toJSONSchema - output numbers with exclusive range correctly when targetingopenapi-3.0(#β5139)1e71ca9docs: fix refine fn to encode works properly (#β5148)a85ec3cfix(docs): correct example to useLooseDoginstead ofDog(#β5136)3e982744.1.3v4.1.2Compare Source
Commits:
e45e61bImprove codec docs25a4c37fix(v4): toJSONSchema - wrong record tuple output when targetingopenapi-3.0(#β5145)0fa4f46Use method form in codecs.mdx940383dUpdate JSON codec and docs3009fa84.1.2v4.1.1Compare Source
Commits:
648eb43Remove codecs from sidebare7e39a99Improve codec docse5085beAdd images028b289Add methods10cc9944.1.1v4.1.0Compare Source
The first minor version since the introduction of Zod 4 back in May. This version contains a number of features that barely missed the cut for the 4.0 release. With Zod 4 stable and widely adopted, there's more time to resume feature development.
Codecs
This is the flagship feature of this release. Codecs are a new API & schema type that encapsulates a bi-directional transformation. It's a huge missing piece in Zod that's finally filled, and it unlocks some totally new ways to use Zod.
New top-level functions are added for processing inputs in the forward direction ("decoding") and backward direction ("encoding").
.parse()vs.decode()Both
.parse()anddecode()process data in the "forward" direction. They behave identically at runtime.There is an important difference however. While
.parse()accepts any input,.decode()expects a strongly typed input. That is, it expects an input of typestring, whereas.parse()acceptsunknown.Encoding
You can use any Zod schema with
.encode(). The vast majority of Zod schemas are non-transforming (the input and output types are identical) so.decode()and.encode()behave identically. Only certain schema types change their behavior:B->Aand executes theencodetransform during encodingB->Ainstead ofA->BThe usual async and safe variants exist as well:
Example codecs
Below are some "worked examples" for some commonly-needed codecs. These examples are all tested internally for correctness. Just copy/paste them into your project as needed. There is a more comprehensive set available at zod.dev/codecs.
stringToBigIntConverts
bigintinto a serializable form.jsonParses/stringifies JSON data.
To further validate the data,
.pipe()the result of this codec into another schema.Further reading
For more examples and a technical breakdown of how encoding works, reads theannouncement blog post and new Codecs docs page. The docs page contains implementations for several other commonly-needed codecs:
stringToNumberstringToIntstringToBigIntnumberToBigIntisoDatetimeToDateepochSecondsToDateepochMillisToDatejsonCodecutf8ToBytesbytesToUtf8base64ToBytesbase64urlToByteshexToBytesstringToURLstringToHttpURLuriComponentstringToBoolean.safeExtend()The existing way to add additional fields to an object is to use
.extend().Unfortunately this is a bit of a misnomer, as it allows you to overwrite existing fields. This means the result of
.extend()may not literallyextendthe original type (in the TypeScript sense).To enforce true
extendslogic, Zod 4.1 introduces a new.safeExtend()method. This statically enforces that the newly added properties conform to the existing ones.Importantly, this new API allows you to safely extend objects containing refinements.
Previously (in Zod 4.x) any refinements attached to the base schema were dropped in the extended result. This was too unexpected. It now throws an error. (Zod 3 did not support extension of refined objects either.)
z.hash()A new top-level string format for validating hashes produced using various common algorithms & encodings.
The following hash algorithms and encodings are supported. Each cell provides information about the expected number of characters/padding.
"hex""base64""base64url""md5""sha1""sha256""sha384""sha512"z.hex()To validate hexadecimal strings of any length.
Additional changes
FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF) per the RFC$ZodFunctionis now a subtype of$ZodTypeCommits
edd4fea- Closes #β51275d4a315- Closes #β5116f3f0955- Closes #β51080114d5b- #β51223b077c3- #β51211e06af8- #β5113b01b6f3β #β5052571ab0cβ #β5051d3ea111β #β5049b8e3f87β #β4865v4.0.17Compare Source
Commits:
1cebf33Add blog (#β5074)fc1e556Fixes #β5073cc63f95v4.0.17v4.0.16Compare Source
Commits:
d589186fix: ensure keyof returns enum (#β5045)4975f3afeat: add discriminator generic (#β5044)0a463e3Update speakeasy files12658afFix Edit page buttons47e6604fix:edit this pagebutton, now redirects to correct url using the new path (#β5056)7207a2dUpdate Hey API link to Zod v3 plugin (#β5060)6887ff3Update Hey API link to Zod plugin (#β5059)ffff1aaClone POJO objects during defaulting/prefaultinga227cb3v4.0.16v4.0.15Compare Source
Commits:
7e7e346Clean up docsf2949a8[docs] Fix migration guide upgrade command (#β5021)d43cf19Fix recursive object initialization errors with check() and other methods (#β5018)3de2b63fix: remove redundant Required<> from input and output type definitions (#β5033)93553bdAdd needs info03cfa8d4.0.15v4.0.14Compare Source
Commits:
99391a8Docs: Fix typo (#β5005)e25303eDocs: fix typo (#β5008)dbb05efAdd JSON Schema draft-04 output (#β4811)b8257d7Improve tuple recursive inference.9bdbc2fAvoid infinite loops in defineLazy. Fixes #β4994.af96ad44.0.14v4.0.13Compare Source
Commits:
362eb33Fix optional + pipe handling. Closes #β5002. v4.0.13v4.0.12Compare Source
Commits:
ff83fc9Add eslint-plugin-import-zod (#β4848)7c9ce38Update docs for z.property check (#β4863)c432577docs: add jwt schema docs (#β4867)35e6a6fAdd llms.txt (#β4915)3ac7bf0Clean up Edit this Page60a9372Implementllms-full.txt(#β5004)73a19704.0.12v4.0.11Compare Source
Commits:
8e6a5f8Fix βEdit on Githubβ link (#β4997)930a2f6Fix number of errors in doc (#β4993)c762dbbfeat(locale): Add Yoruba (yo) locale (#β4996)9a34a3aZod 4.0.11 (#β4981)v4.0.10Compare Source
Commits:
291c1caAdd should-build scripte32d99bMove should-build scriptd4faf71Add v3 docs (#β4972)dfae371Update Jazz img on v3 docsd6cd30dfix #β4973 (#β4974)1850496Fix typo invalype(#β4960)4ec2f87Add Zod Playground to zod 4 ecosystem (#β4975)2b571a2Update docs z.enum with object literal example (#β4967)813451dv4.0.10 (#β4978)v4.0.9Compare Source
Commits:
4e7a3efv4.0.9 (#β4970)v4.0.8Compare Source
Commits:
3048d14Fix #β4961v4.0.7Compare Source
Commits:
7ab1b3cDo not continue parsing in ZodPipe if issues exists. Closes #β4926.34b400a4.0.7v4.0.6Compare Source
Commits:
a3e4391Unwiden catch input type (#β4870)499df78Add RFC 9562 mentions. Closes #β4872d0493f3Doc tweak - spread vs destructuring (#β4919)8dad394feat: Icelandic translation (#β4920)2ffdae1Bulgarian (bg) translation (#β4928)0973135docs: add valype to xToZodConverts (#β4930)d257340Remove moduleResolution callout (#β4932)075970ddocs: add coercion note to fix compile errors (#β4940)b9e8a60Add@hey-api/openapi-tsto Zod 3 ecosystem (#β4949)ad7b0ffAdd@hey-api/openapi-tsto Zod 3 ecosystem (#β4942)4619109feat(locales): add Danish translations (#β4953)cb84a57Point to zod-v3-to-v4 codemod in Zod 4 migration guide (#β4954)28a5091Update api.mdx (#β4955)7f3cf94Fix URL sup example (#β4959)17e7f3bAdd@hey-api/openapi-tsto Zod 4 ecosystem (#β4950)f75d852fix: escapes decimal place inz.literal(#β4895)7dd7484v4.0.6 (#β4941)v4.0.5Compare Source
Commits:
f91a73eSupport pipes in discriminated unions. Closes #β4856 (#β4861)45afab04.0.5v4.0.4Compare Source
Commits:
9335f05AddsZodFirstPartyTypeKindstub to fix module resolution failure insidezod-to-json-schemav4.0.3Compare Source
Commits:
5905a8dImprove check-versions scriptf3e749bRemove global File interface44a936c4.0.274006edFix JSR provenanceff4af5e4.0.3ce573e8Update test badge9a7161aFix versionsv4.0.2Compare Source
v4.0.1: v4.0.0Compare Source
With this release,
[email protected]has been published tonpm. There were no code changes between 3.25.76 and 4.0.0!Zod 4 has been stable for the past 6 weeks, but it was published inside [email protected] on npm. this transitionary window gave the ecosystem time to incrementally support for Zod 4 (without dropping support for Zod 3). As there is now near-universal support for Zod 4 in the ecosystem, ths time feels right to finally put a bow on things π
To upgrade to Zod 4:
If youβve already migrated to Zod 4 using the subpaths, there are no changes required. however you can optionally simplify your imports (recommended)
Library authors β if you've already implemented Zod 4 support according to the best practices outlined in the Library authors guide, bump your peer dependency to include
zod@^4.0.0:There should be no other code changes necessary. No code changes were made between the latest
3.25.xrelease and4.0.0. This does not require a major version bump.v4.0.0Compare Source
Configuration
π Schedule: Branch creation - "before 9am on Monday" in timezone UTC, Automerge - At any time (no schedule defined).
π¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
β» Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.