fix(deps): update dependency zod to v4#138
Open
red-hat-konflux[bot] wants to merge 1 commit intomasterfrom
Open
fix(deps): update dependency zod to v4#138red-hat-konflux[bot] wants to merge 1 commit intomasterfrom
red-hat-konflux[bot] wants to merge 1 commit intomasterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
Summary by CodeRabbit
WalkthroughThe ChangesZod Dependency Upgrade
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 6/10 reviews remaining, refill in 20 minutes and 38 seconds. Comment |
9981b73 to
82c6b17
Compare
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
82c6b17 to
9d403bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
^3.24.1→^4.0.0Warning
Some dependencies could not be looked up. Check the warning logs for more information.
Release Notes
colinhacks/zod (zod)
v4.4.2Compare Source
Commits:
0c62df0Clean up docs navigation and stale labels (#5901)20cc794chore: add security policy and refresh tooling deps6fbe07bfix(docs): heading anchor links now include the hash so it doesnt scoll all the way up, follows navbar logic (#5791)4bbed1bTighten discriminated union option typingbbac3e5Update PR guidance for agentscf0dc94Merge remote-tracking branch 'origin/main' into fix-discriminated-union-key-constraint292c894docs: add Zernio gold sponsor1fc9f31docs: document codec inversion1373c85docs: remove AI disclosure guidancee20d02bchore: ignore triage notese58ea4ddocs: test Zod Mini tab code heights905761adocs: document preprocess input type narrowingbf64bacchore: tighten test guidance in AGENTS.md8ec4e73chore: update play.ts scratch02c2bafMake z.preprocess defer optionality to inner schema (#5929)88015dffix(docs): drop deprecatedbaseUrlfrom tsconfigc59d4474.4.2v4.4.1Compare Source
Commits:
481f7beci: gate release publishing on full test workflow95ccab4test(v3): restore optional undefined expectationscede2c6fix(v4): reject tuple holes before required defaults (#5900)edd0bf0release: 4.4.1180d83ddocs: remove Jazz featured sponsorv4.4.0Compare Source
4.4.0
This is a minor release with a wide set of correctness and soundness fixes. Some fixes intentionally make Zod stricter, so code that depended on previously accepted invalid or ambiguous inputs may need small updates.
Potentially breaking bug fixes
Tuple defaults now materialize output values correctly
Fixed in #5661. Tuple parsing now more accurately reflects defaults, optional tails, explicit
undefined, and under-filled inputs. The headline behavior is that defaults in tuple positions now properly appear in parsed output.Trailing optional elements that are absent still stay absent; they are not filled with
undefined.But explicit
undefinedvalues supplied by the caller are preserved.When optional elements appear before later defaults, the parsed tuple is now dense so array operations behave predictably.
Tuple length errors are also more consistent now. Since
z.function()arguments are tuple-shaped, function input errors may look different.Required object properties with
z.undefined()Fixed in #5661, with follow-up coverage in
57d80a82. A property whose schema isz.undefined()is now treated as required. The key must be present, but its value may beundefined.Use
.optional()when the key itself may be absent.This also affects related
.catch(),.partial(),.default(), and.prefault()combinations that previously relied on missingz.undefined()keys being treated as optional.Safer
.merge()behavior with refinementsFixed in #5856. The
.merge()method now throws when the receiver has refinements, rather than silently producing ambiguous refinement behavior. Refinements from the second schema are preserved.JSON Schema
$defsentries no longer include redundantidFixed in #5759. JSON Schema conversion through
z.toJSONSchema()now strips redundantidfields from$defsentries. This is required for correctness in older JSON Schema dialects from before$idwas introduced: in those dialects,idchanges the resolution scope, so leaving it inside an extracted definition can make references resolve incorrectly. The removed value was redundant because the schema had already been extracted into$defs, so the definition key itself is the identifier. This may affect consumers that were reading those internalidfields directly.Other JSON Schema fixes in this release:
.describe(): #5797String validators are stricter
Base64 validation now rejects whitespace instead of allowing
atob()-style whitespace stripping. Fixed in #5888.Other string validator changes:
z.cuid()has been tightened, and CUID v1 is now deprecated. Fixed in #5880.z.httpUrl()now rejects malformed HTTP(S) URLs with a missing slash after the protocol. The underlyingURLconstructor normalizes inputs likehttps:/example.com, but Zod now rejects them instead of accepting the repaired URL. Fixed in #5672, related to #5284.Union paths are fixed in formatted errors
Two union-related error fixes landed:
z.treeifyError()andz.formatError(). Fixed in #5708 and60ff3987.ZodErroroutput.Other fixes
Record key transforms now run
Fixed in #5891. Record schemas now run transforms on record keys.
Related record fixes:
invalid_keyissues. Fixed in #5719.z.record(valueType)form works again. Fixed in0e960108.Metadata and input handling in
fromJSONSchema()Schema generation from JSON Schema now applies metadata more consistently across
enum,const,not,anyOf, and multi-type schemas. Fixed in #5758. It also rejects or normalizes more non-JSON-like inputs, including cyclic objects andBigInt. Fixed in87cf0f93.Codecs
Codec changes:
z.discriminatedUnion().encode()now works when the discriminator uses a codec. Fixed in #5769.Transform context
Transform callbacks now support
ctx.addIssue(). Fixed in #5699.Conditional
.superRefine()withwhenThe
whenoption was added for.superRefine(). Added in #5741, with related abort behavior fixed in #5681.Defaults for
MapandSetDefaults for
MapandSetare now cloned instead of shared across parses. Fixed in #5855.Empty unions
Empty
z.union([]),z.xor([]), and discriminated unions no longer crash at construction time. They construct and fail at parse time. Fixed in #5869.Floating-point multiples
Number
multipleOf()/step()validation is more accurate for decimal and exponent edge cases. Fixed in #5687 and #5793.Global config and
jitlessConfiguration fixes:
globalThis, improving behavior across mixed CJS/ESM module instances. Fixed in #5889.Prototype pollution hardening
Object catchall paths now skip
__proto__keys. Fixed in #5898.Performance improvements
Reduced memory usage from lazy-bound methods
Fixed in #5897. Classic builder methods are now lazy-bound through a shared internal prototype instead of eagerly attached per schema instance. This significantly reduces per-schema method allocation overhead, especially in codebases that construct many schemas. Detached methods continue to work:
Improved tree-shaking
Implemented in
195e8696and #5689. Top-level factory calls are annotated as pure, and generated stub package manifests now includesideEffects: false. This gives bundlers more room to remove unused Zod code.This is intended as the conclusive fix for a long-standing class of tree-shaking and bundle-size issues, especially in Next.js and Turbopack projects. The most visible symptom was that unused validators and locales could survive bundling even when importing from
zod/minior from a narrow subpath.Related reports include:
zod/minibundle-size reports: #5561, #5665, #4369, #4572{ "sideEffects": false }Locales
Added or updated locale support:
Locale message text changed in some cases, which may affect snapshots.
Closed issues
The following issues were closed by PRs included in this release:
string.abort: truein.refine()checks withwhen.addIssueto transform context.deleteinfinalizeIssue.optionsto invalid discriminator errors.fromJSONSchema().idfrom$defsentries in JSON Schema output.z.custom()docs for v4 compatibility.discriminatedUnion().encode()with codec discriminators.multipleOf()validation.MapandSetdefaults..merge()refinement semantics with.extend().jitlessconfig in the eval probe.z.union([])andz.xor([]).z.record().Commits
44f6a03efix(locales): correct Georgian translation for 'string' to 'ველი' (#5655) by @tushargr0ver7b43bc64docs(ecosystem): add Hono Takibi (#5651) by @nakita628119376b9feat: add map support to Uzbek locale (#5599) by @uchkunr8fbf701etest: add edge case tests for boundary values (#5601) by @uchkunrf1f93c2bFix order of brand method examples in api.mdx (#5604) by @onurtemiz10105ee4docs: Fix typos in json-schema documentation (#5608) by @SaKaNa-Y2d367139feat: add hr translation (#5610) by @vuki65654902cb7chore: update pullfrog.yml workflow89ba70f2chore: add sideEffects false to stub package.json for tree-shaking (#5689) by @jesse-holdeneaa3c2c3Update positive checks to use alias.gt(0)in the docs (#5671) by @Fredkiss365f1f404fix typo (#5676) by @Nikita0x5b574501fix: respectabort: truein.refine()for checks withwhenfunction (#5681)539de140docs: fix README links for async refinements/transforms (#5682) by @pavan-sh46cd10e7docs: fix README anchor links for async APIs (#5683) by @pavan-sh55747b3cRemove deprecated downlevelIteration option (#5684) by @RyanCavanaugh3a818de1fix(v4): handle multi-digit exponents in floatSafeRemainder (#5687) by @shakecodeslikecray3cd45ebcfix(v4): add strict validation tohttpUrl()(#5672) by @LuckySilver00217d98c909add Sanity as silver sponsor and Mintlify as bronze sponsorc7805073move Sanity and Mintlify to top of sponsor listsbee2dc8ddocs: movez.iso.time()from format to pattern section (#5696)2f8414bcfix: add missing addIssue to transform context (#5699) by @F-A-N-D-Ed3c0ec87docs: add note about removed.errorsalias in v4 changelog (#5705) by @togami2864fa338a3bfix(v4): JSON schema min/max intersection for draft-04 and openapi-3.0 (#5700) by @ebroder3473b288chore: bump zshy to ^0.7.1cc8f9b7cdocs: improve README wording and fix typos (#5736) by @vedanshshettif5336717feat: add json-up to ecosystem (#5740) by @mrspence60ff3987fix(v4): preserve parent path when treeifying nested union/key/element issues08b14b51perf: avoiddeleteinfinalizeIssueto keep V8 fast mode (#5718)9cf868d2fix(v4): treeify error nested union bug (#5708) by @dstashevskyi28f39a6dAdd JSONType export (#5709) by @RobinVdBroeck65fab33efeat: allowwhenparameter in.superRefine()(#5741) by @vilvai7f87df1erefactor(v4): remove unnecessary type assertions (#5720) by @chisaki66518f15ddPreprocess is not deprecated (#5721) by @mxdvl2e5b23dcfix: add options to invalid discriminator errors (#5723) by @Danielchinasa7f789deffix: skip non-enumerable properties in record validation (#5719) by @veeceeyee15fa19docs: add AGENTS notes for JSDoc, PR comments, and PR worktree workflowf52b4d28Revert "docs: improve README wording and fix typos (#5736)"ddb41391test: increase timeout for redos checker in datetime.test.ts (#5744) by @rishadaufabc07e459docs: fix doc (#5745) by @xgaiae06af5deUpdate Hey API description (#5748) by @mrlubos28c156e2fix: apply description and default metadata to enum, const, and not schemas in fromJSONSchema (#5758) by @mibragimovf457edf1Fix grammar in CONTRIBUTING.md (#5765) by @siekmang411f6c64fix(v4): resolve stack overflow in toJSONSchema for recursive lazy with describe (#5797) by @Hassad67445dd421edocs: add tone guidelines for issue and PR comments to AGENTS.mdddd20a30test: align optional property assertions with actual inferred typesa1cf8a93docs: update z.custom example for v4 compatibility (#5763) by @andrewdameliob6a3b336fix: strip redundant id from$defsentries in toJSONSchema (#5759) by @mibragimovc7a8ccc0fix: discriminatedUnion encode() with codec discriminator (#5769) by @mahmoodhamdi87cf0f93fix(fromJSONSchema): normalize input via JSON round-trip7163e6f2feat: add.invert()method to ZodCodec (#5770) by @mahmoodhamdib59b9b13fix: replace.defaultwith.prefault(#5776) by @alanskovrlj93bba686docs: add Zod AOT to ecosystem page (#5806) by @wakita1810092564caa4fix(docs): add custom 404 page with proper theme support (#5779) by @WolfieLeader5b7ed214fix: correct multipleOf float validation using tolerance-based comparison (#5793) by @cyphercodescc9139d2docs: fix self-referencing schema in refine when() example (#5812) by @claygeo0e960108fix(v4): support v3-style single-arg z.record(valueType)41b25af9docs(agents): refine PR comment tone guidance4c03c20dUpdate Italian locale error messages for validation (#5852) by @pastorello37ac1ba0fix(fr): translate issue.origin in too_big/too_small errors (#5845) by @Ouaziz-chedli345be203docs: add validex to ecosystem (#5848) by @chiptoma3c1f32bdfeat(locales/en): handle instanceof and add comprehensive locale tests888e52bbfeat(locales): add Greek (el) locale (#5840) by @saileshbrobf6d99edRevert "feat(locales/en): handle instanceof and add comprehensive locale tests"e8196a8dfix(resolution): align expected fr message with translated localeb6b12882correct logic for validating length (#5843) by @nameearly34f60159fix(v4): clone Map and Set in shallowClone to prevent shared state across.default()parses (#5855) by @artur-seppa91a7d0d1fix(v4): reject whitespace in z.base64() to close atob bypass23edf484Revert "fix(v4): reject whitespace in z.base64() to close atob bypass"15cafa13fix(v4): throw on.merge()receiver with refinements; preserve refinements from second schema (#5856) by @solssak584b1089fix(v4): reject whitespace in z.base64() to close atob bypass (#5888) by @colinhacksb9b62c65fix(core): honourjitlessconfig inallowsEvalprobe (#5864) by @doksonfffe99bdfix(v4): construct empty unions instead of crashing (#5869) by @tjenkinson285bde7ffeat(core): shareglobalConfigacross module systems viaglobalThis(#5889) by @colinhacks195e8696perf(v4): mark top-level factory calls as/*@​__PURE__*/for tree-shaking61d7bedbfix(v4): apply key schema transforms in z.record() (#5891) by @colinhacks45acd2adci(release): switch to npm trusted publishing via OIDC (#5890) by @colinhacks476ae243Tighten cuid() regex and deprecate CUID v1 (#5880) by @colinhacks6217527edocs(agents): document push-to-main footgun and version-bump rule (#5883) by @colinhacks757f0b0ffix(v4): apply util.Writeable in strictObject/looseObject for shape display parity (#5882) by @colinhacksfa4a3740fix(v4): apply util.Writeable in mini object constructors and extend/safeExtend/partial/required (#5895) by @colinhacksebc8287cfix(v4): emit falsy prefault values in toJSONSchema (#5893) by @mixelburg8fcb71a5perf(v4): lazy-bind builder methods to shared internal prototype (#5897) by @colinhacks76e8f706fix(v4): skip__proto__key in object catchall (#5898) by @colinhacksf0b0608eecosystem:eslint-plugin-zod-xiseslint-plugin-zodnow (#5637) by @marcalexiei0b5c3bc2docs: fix refinements examples in api.mdx (#5649) by @playoffthecuff327e152edocs(agents): refine PR comment tone guidance further57d80a82test(v4): pin object/tuple key optionality through optout propagationf19860f1fix: preserve context immutability in parse functions (#5632) by @bgk614ec979ad7feat: add Romanian (ro) locale (#5657) by @tushargr0verb6066b3efix(v4): align object and tuple optionality handling (#5661) by @Cyjin-janiad0b8271ci: update release workflow for trusted publishing6db607befix(release): keep JSR manifest publishablef778e02abuild: bump zshy for JSR wildcard exportsv4.3.6Compare Source
Commits:
9977fb0Add brand.dev to sponsorsf4b7baeUpdate pullfrog.yml (#5634)251d716Clean up workflow_calledd4132fix: add missing User-agent to robots.txt and allow all (#5646)85db85efix: typo in codec.test.ts file (#5628)cbf77bbAvoid non null assertion (#5638)dfbbf1cAvoid re-exported star modules (#5656)762e911Generalize numeric key handlingca3c862v4.3.6v4.3.5Compare Source
Commits:
21afffd[Docs] Update migration guide docs for deprecation of message (#5595)e36743eImprove mini treeshaking0cdc0b84.3.5v4.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.