chore(deps): update dependency zod to v4.3.4 #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.1.12->4.3.4Release Notes
colinhacks/zod (zod)
v4.3.4Compare Source
Commits:
1a8bea3Add integration testse01cd02Support patternProperties for looserecord (#5592)089e5fbImprove looseRecord docsdecef9cFix lint9443aabDrop iso time in fromJSONSchema66bda74Remove .refine() from ZodMiniTypeb4ab94c4.3.4v4.3.3Compare Source
Commits:
f3b2151v4.3.3v4.3.2Compare Source
Commits:
bf96635Loosen strictObjectinside intersection (#5587)f71dc01Remove Juno (#5590)0f41e5a4.3.2v4.3.1Compare Source
Commits:
0fe8840allow non-overwriting extends with refinements. 4.3.1v4.3.0Compare Source
This is Zod's biggest release since 4.0. It addresses several of Zod's longest-standing feature requests.
z.fromJSONSchema()Convert JSON Schema to Zod (#5534, #5586)
You can now convert JSON Schema definitions directly into Zod schemas. This function supports JSON Schema
"draft-2020-12","draft-7","draft-4", and OpenAPI 3.0.The API should be considered experimental. There are no guarantees of 1:1 "round-trip soundness":
MySchema>z.toJSONSchema()>z.fromJSONSchema(). There are several features of Zod that don't exist in JSON Schema and vice versa, which makes this virtually impossible.Features supported:
string,number,integer,boolean,null,object,array)email,uri,uuid,date-time,date,time,ipv4,ipv6, and more)anyOf,oneOf,allOf)additionalProperties,patternProperties,propertyNames)prefixItems,items,minItems,maxItems)$reffor local references and circular schemasz.xor()— exclusive union (#5534)A new exclusive union type that requires exactly one option to match. Unlike
z.union()which passes if any option matches,z.xor()fails if zero or more than one option matches.When converted to JSON Schema,
z.xor()producesoneOfinstead ofanyOf.z.looseRecord()— partial record validation (#5534)A new record variant that only validates keys matching the key schema, passing through non-matching keys unchanged. This is used to represent
patternPropertiesin JSON Schema..exactOptional()— strict optional properties (#5589)A new wrapper that makes a property key-optional (can be omitted) but does not accept
undefinedas an explicit value.This makes it possible to accurately represent the full spectrum of optionality expressible using
exactOptionalPropertyTypes..apply()A utility method for applying arbitrary transformations to a schema, enabling cleaner schema composition. (#5463)
.brand()cardinalityThe
.brand()method now accepts a second argument to control whether the brand applies to input, output, or both. Closes #4764, #4836.Type predicates on
.refine()(#5575)The
.refine()method now supports type predicates to narrow the output type:ZodMapmethods:min,max,nonempty,size(#5316)ZodMapnow has parity withZodSetandZodArray:.with()alias for.check()(359c0db)A new
.with()method has been added as a more readable alias for.check(). Over time, more APIs have been added that don't qualify as "checks". The new method provides a readable alternative that doesn't muddy semantics.z.slugify()transformTransform strings into URL-friendly slugs. Works great with
.with():z.meta()andz.describe()in Zod Mini (947b4eb)Zod Mini now exports
z.meta()andz.describe()as top-level functions for adding metadata to schemas:More ergonomic intersections #5587
When intersecting schemas that include
z.strictObject(), Zod 4 now only rejects keys that are unrecognized by both sides of the intersection. Previously, any unrecognized key from either side would cause an error.This means keys that are recognized by at least one side of the intersection will now pass validation:
When both sides are strict, only keys unrecognized by both sides will error:
New locales
am) (#5531)uz) (#5519)Bug fixes
All of these changes fix soundness issues in Zod. As with any bug fix there's some chance of breakage if you were intentionally or unintentionally relying on this unsound behavior.
.pick()and.omit()disallowed on object schemas containing refinements (#5317)Using
.pick()or.omit()on object schemas with refinements now throws an error. Previously, this would silently drop the refinements, leading to unexpected behavior.Migration: The easiest way to migrate is to create a new schema using the
shapeof the old one..extend()disallowed on object schemas with refinements (#5317)Similarly,
.extend()will throws on schemas with refinements if you are overwriting existing properties.Instead you can use
.safeExtend(), which statically ensures that you aren't changing the type signature of any pre-existing properties.Object masking methods (
.pick(),.omit()) now validate that the keys provided actually exist in the schema:Additional changes
z.iso.timewith minute precision (#5557)includesmethod params typing to acceptstring | $ZodCheckIncludesParams(#5556)implementAsyncinferred type to always be a promise (#5476)Dateinstances to numbers inminimum/maximumchecks (#5351)z.record()(#5585)~standardschema property (#5363)@__NO_SIDE_EFFECTS__for better tree-shaking (#5475)v4.2.1Compare Source
Commits:
5b5b1294.2.1v4.2.0Compare Source
Features
Implement Standard JSON Schema
standard-schema/standard-schema#134
Implement
z.fromJSONSchema()Implement
z.xor()Implement
z.looseRecord()Commits:
af49c08Update docs for JSON Schema conversion ofz.undefined()(#5504)767f320Add.toJSONSchema()method (#5477)e17dcb6Addz.fromJSONSchema(),z.looseRecord(),z.xor()(#5534)v4.1.13Compare Source
Commits:
5c2602cUpdate AI widget (#5318)d3da530reflect the specified regex correctly in error (#5338)39f8c45faster initialization (#5352)e9e2790Clean up comment8e4739fUpdate inferred z.promise() type2849df8fix(locales): improve Dutch (nl) localization (#5367)b0d3c9fRun tests on windows6fd61b7feat unitest (#5358)a4e4bc8Lock to node 248de8badFix windows buildb2c186bUse Node LTSb73b1f6Consolidate isTransforming logicd85f3eaFix #53531bac0f3Fix test.yml86d4dadFix partial record5e6c0fdFix attw on windows27fc616Extend test timeout8d336c4Remove windows runner5be72e0chore(doc): update metadata.tsx (#5331)cb0272adocs: add 'cd zod' step to development setup instructions (#5394)24e3325docs: replace 'Refinement' with 'Transform' in transforms section (#5397)644a082chore: add resource for validating environment variables with Zod (#5403)5e1cfcfChange doc for email validation method in Zod schema (#5392)88cf944Fix: Iterate over keys in catchall object using "in" operator. (#5376)aa43732Emphasise thatenumvalidates against values, for object literal &enums (#5386)3a4bd00Improve Hebrew localization for Zod error messages (#5409)c10f9d1Fix typos (#5420)86f0ef9Documentation Improvements (#5417)e120a48Fix opt tuplef9bbb50Improve tuple0ba0f34Optimize docs caching/ISR (#5433)c3ec66cImprove docs cachingc8cce4bdocs: fix typos and links (#5428)84ec047docs(ecosystem): Add react-f3 (#5429)3396515Docs: Fix typo in safeExtend description (#5445)3d93a7dfeat: MAC address validation in v4 and mini (#5440)f2f0d17Fix dual package hazard forglobalRegistry(#5452)9fc493ffix: use oneOf for discriminated unions in JSON Schema (#5453)603dbe8Clean up regex, drop backreferencesab69b9eUpdate mac addr testsf791052chore: upgrade vitest to v4 (#5028)f97e80dfix(core): prevent infinite recursion for recursive tuples (#5089) (#5094)002e01afix(record): handle non-function constructor field in isPlainObject (#5098)6716517docs(contributing): add instructions on building @zod/docs (#5114)8b0603dFix typo in ISO time documentation (#5277)be85eccdocs(codecs): correctstringToDatesafeDecode methods (#5302)50bba54Add zodgres to ecosystem documentation (#5308)377f5d1Addzod-to-mongo-schemato ecosystem documentation (#5457)dea32d5docs(ecosystem): add fn sphere and zod-compare (#5326)02ea4c8Add Claude Code GitHub Workflow (#5460)d44253dAdd support for number literal and TypeScript's enum keys inz.record(#5334)f52344eFix vitest 40f4ce73Do not allow unsound pick/omit162fe29Add z.meta and z.describe3de39eeImplement slugify5bfc8f2Fix docs0e803a2Revert "Do not allow unsound pick/omit"a774750v4.1.132cdd82b4.1.134063e80Update check-semver scriptConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.