Skip to content
verdict:

Zod 4.4.0

notable

note: no summary for this older release

We summarize recent releases. The original release notes for this version are below.

release-notesgithub.com/colinhacks/zod · 401 lines
  1. ## 4.4.0
  2. 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.
  3. ## Potentially breaking bug fixes
  4. ### Tuple defaults now materialize output values correctly
  5. Fixed in [#5661](https://github.com/colinhacks/zod/pull/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.
  6. ```ts
  7. const schema = z.tuple([
  8. z.string(),
  9. z.string().default("fallback"),
  10. ]);
  11. schema.parse(["a"]);
  12. // ["a", "fallback"]
  13. ```
  14. Trailing optional elements that are absent still stay absent; they are not filled with `undefined`.
  15. ```ts
  16. const schema = z.tuple([
  17. z.string(),
  18. z.string().optional(),
  19. ]);
  20. schema.parse(["a"]);
  21. // ["a"]
  22. ```
  23. But explicit `undefined` values supplied by the caller are preserved.
  24. ```ts
  25. schema.parse(["a", undefined]);
  26. // ["a", undefined]
  27. ```
  28. When optional elements appear before later defaults, the parsed tuple is now dense so array operations behave predictably.
  29. ```ts
  30. const schema = z.tuple([
  31. z.string(),
  32. z.string().optional(),
  33. z.string().default("fallback"),
  34. ]);
  35. schema.parse(["a"]);
  36. // ["a", undefined, "fallback"]
  37. ```
  38. Tuple length errors are also more consistent now. Since `z.function()` arguments are tuple-shaped, function input errors may look different.
  39. ### Required object properties with `z.undefined()`
  40. Fixed in [#5661](https://github.com/colinhacks/zod/pull/5661), with follow-up coverage in [`57d80a82`](https://github.com/colinhacks/zod/commit/57d80a82bde8877f3eb79e5dad9786096c37490f). A property whose schema is `z.undefined()` is now treated as required. The key must be present, but its value may be `undefined`.
  41. ```ts
  42. const schema = z.object({
  43. value: z.undefined(),
  44. });
  45. schema.safeParse({}).success;
  46. // false
  47. schema.safeParse({ value: undefined }).success;
  48. // true
  49. ```
  50. Use `.optional()` when the key itself may be absent.
  51. ```ts
  52. const schema = z.object({
  53. value: z.undefined().optional(),
  54. });
  55. schema.safeParse({}).success;
  56. // true
  57. ```
  58. This also affects related `.catch()`, `.partial()`, `.default()`, and `.prefault()` combinations that previously relied on missing `z.undefined()` keys being treated as optional.
  59. ### Safer `.merge()` behavior with refinements
  60. Fixed in [#5856](https://github.com/colinhacks/zod/pull/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.
  61. ```ts
  62. const a = z.object({ a: z.string() }).refine((val) => val.a.length > 0);
  63. const b = z.object({ b: z.string() });
  64. a.merge(b);
  65. // throws
  66. ```
  67. > Prefer `.extend()` or `.safeExtend()` for object composition. The `.merge()` method is still supported for compatibility, but it is discouraged for new code because its semantics around overlapping keys and refinements are easier to misread.
  68. ### JSON Schema `$defs` entries no longer include redundant `id`
  69. Fixed in [#5759](https://github.com/colinhacks/zod/pull/5759). JSON Schema conversion through `z.toJSONSchema()` now strips redundant `id` fields from `$defs` entries. This is required for correctness in older JSON Schema dialects from before `$id` was introduced: in those dialects, `id` changes 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 internal `id` fields directly.
  70. Other JSON Schema fixes in this release:
  71. - Draft-04/OpenAPI 3.0 min/max intersections: [#5700](https://github.com/colinhacks/zod/pull/5700)
  72. - Recursive lazy schemas with `.describe()`: [#5797](https://github.com/colinhacks/zod/pull/5797)
  73. - Falsy prefault values emitted as defaults: [#5893](https://github.com/colinhacks/zod/pull/5893)
  74. - CUID pattern output tightened: [#5880](https://github.com/colinhacks/zod/pull/5880)
  75. ### String validators are stricter
  76. Base64 validation now rejects whitespace instead of allowing `atob()`-style whitespace stripping. Fixed in [#5888](https://github.com/colinhacks/zod/pull/5888).
  77. ```ts
  78. z.base64().safeParse("Zm9v").success;
  79. // true
  80. z.base64().safeParse("Zm 9v").success;
  81. // false
  82. ```
  83. Other string validator changes:
  84. - CUID validation through `z.cuid()` has been tightened, and CUID v1 is now deprecated. Fixed in [#5880](https://github.com/colinhacks/zod/pull/5880).
  85. - HTTP URL validation through `z.httpUrl()` now rejects malformed HTTP(S) URLs with a missing slash after the protocol. The underlying `URL` constructor normalizes inputs like `https:/example.com`, but Zod now rejects them instead of accepting the repaired URL. Fixed in [#5672](https://github.com/colinhacks/zod/pull/5672), related to [#5284](https://github.com/colinhacks/zod/issues/5284).
  86. ```ts
  87. z.httpUrl().safeParse("https://example.com").success;
  88. // true
  89. z.httpUrl().safeParse("https:/example.com").success;
  90. // false
  91. z.httpUrl().safeParse("http:/www.apple.com").success;
  92. // false
  93. ```
  94. ### Union paths are fixed in formatted errors
  95. Two union-related error fixes landed:
  96. - Nested union paths are now preserved correctly in the output of `z.treeifyError()` and `z.formatError()`. Fixed in [#5708](https://github.com/colinhacks/zod/pull/5708) and [`60ff3987`](https://github.com/colinhacks/zod/commit/60ff398771bb4b6df04d96f00b9a10ee561ee7af).
  97. - Invalid discriminated union errors now include discriminator options and improved messages. Fixed in [#5723](https://github.com/colinhacks/zod/pull/5723). This may affect users snapshotting `ZodError` output.
  98. ## Other fixes
  99. ### Record key transforms now run
  100. Fixed in [#5891](https://github.com/colinhacks/zod/pull/5891). Record schemas now run transforms on record keys.
  101. ```ts
  102. const schema = z.record(
  103. z.string().transform((key) => key.toUpperCase()),
  104. z.number()
  105. );
  106. schema.parse({ foo: 1 });
  107. // { FOO: 1 }
  108. ```
  109. Related record fixes:
  110. - Key refinement failures now surface as structured `invalid_key` issues. Fixed in [#5719](https://github.com/colinhacks/zod/pull/5719).
  111. - Non-enumerable properties are skipped more consistently. Fixed in [#5719](https://github.com/colinhacks/zod/pull/5719).
  112. - The v3-style single-argument `z.record(valueType)` form works again. Fixed in [`0e960108`](https://github.com/colinhacks/zod/commit/0e960108f0d98dbea7844a8ff914f0980352f636).
  113. ### Metadata and input handling in `fromJSONSchema()`
  114. Schema generation from JSON Schema now applies metadata more consistently across `enum`, `const`, `not`, `anyOf`, and multi-type schemas. Fixed in [#5758](https://github.com/colinhacks/zod/pull/5758). It also rejects or normalizes more non-JSON-like inputs, including cyclic objects and `BigInt`. Fixed in [`87cf0f93`](https://github.com/colinhacks/zod/commit/87cf0f93cd0f34bdc69f11c9377568e6812841c4).
  115. ### Codecs
  116. Codec changes:
  117. - Encoding through `z.discriminatedUnion().encode()` now works when the discriminator uses a codec. Fixed in [#5769](https://github.com/colinhacks/zod/pull/5769).
  118. - Codec inversion was added in [#5770](https://github.com/colinhacks/zod/pull/5770).
  119. ```ts
  120. const stringToNumber = z.codec(
  121. z.string(),
  122. z.number(),
  123. {
  124. decode: Number,
  125. encode: String,
  126. }
  127. );
  128. const numberToString = z.invertCodec(stringToNumber);
  129. ```
  130. ### Transform context
  131. Transform callbacks now support `ctx.addIssue()`. Fixed in [#5699](https://github.com/colinhacks/zod/pull/5699).
  132. ### Conditional `.superRefine()` with `when`
  133. The `when` option was added for `.superRefine()`. Added in [#5741](https://github.com/colinhacks/zod/pull/5741), with related abort behavior fixed in [#5681](https://github.com/colinhacks/zod/pull/5681).
  134. ### Defaults for `Map` and `Set`
  135. Defaults for `Map` and `Set` are now cloned instead of shared across parses. Fixed in [#5855](https://github.com/colinhacks/zod/pull/5855).
  136. ```ts
  137. const schema = z.map(z.string(), z.number()).default(new Map());
  138. const a = schema.parse(undefined);
  139. const b = schema.parse(undefined);
  140. a === b;
  141. // false
  142. ```
  143. ### Empty unions
  144. Empty `z.union([])`, `z.xor([])`, and discriminated unions no longer crash at construction time. They construct and fail at parse time. Fixed in [#5869](https://github.com/colinhacks/zod/pull/5869).
  145. ### Floating-point multiples
  146. Number `multipleOf()` / `step()` validation is more accurate for decimal and exponent edge cases. Fixed in [#5687](https://github.com/colinhacks/zod/pull/5687) and [#5793](https://github.com/colinhacks/zod/pull/5793).
  147. ### Global config and `jitless`
  148. Configuration fixes:
  149. - Global configuration is now shared through `globalThis`, improving behavior across mixed CJS/ESM module instances. Fixed in [#5889](https://github.com/colinhacks/zod/pull/5889).
  150. - Jitless mode now avoids eval probing when set before first access. Fixed in [#5864](https://github.com/colinhacks/zod/pull/5864).
  151. ### Prototype pollution hardening
  152. Object catchall paths now skip `__proto__` keys. Fixed in [#5898](https://github.com/colinhacks/zod/pull/5898).
  153. ## Performance improvements
  154. ### Reduced memory usage from lazy-bound methods
  155. Fixed in [#5897](https://github.com/colinhacks/zod/pull/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:
  156. ```ts
  157. const schema = z.string();
  158. const optional = schema.optional;
  159. optional.call(schema);
  160. // still works
  161. ```
  162. ### Improved tree-shaking
  163. Implemented in [`195e8696`](https://github.com/colinhacks/zod/commit/195e86962b5156012a4cdcfbff87dffddce87b78) and [#5689](https://github.com/colinhacks/zod/pull/5689). Top-level factory calls are annotated as pure, and generated stub package manifests now include `sideEffects: false`. This gives bundlers more room to remove unused Zod code.
  164. 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/mini` or from a narrow subpath.
  165. Related reports include:
  166. - Next.js and Turbopack tree-shaking reports: [#4433](https://github.com/colinhacks/zod/issues/4433), [#5641](https://github.com/colinhacks/zod/issues/5641), [#5095](https://github.com/colinhacks/zod/issues/5095), [#4810](https://github.com/colinhacks/zod/issues/4810)
  167. - Locale and `zod/mini` bundle-size reports: [#5561](https://github.com/colinhacks/zod/issues/5561), [#5665](https://github.com/colinhacks/zod/issues/5665), [#4369](https://github.com/colinhacks/zod/issues/4369), [#4572](https://github.com/colinhacks/zod/issues/4572)
  168. - Broader v4 bundle-size reports: [#2596](https://github.com/colinhacks/zod/issues/2596), [#4637](https://github.com/colinhacks/zod/issues/4637), [#4798](https://github.com/colinhacks/zod/issues/4798), [#5206](https://github.com/colinhacks/zod/issues/5206)
  169. ```json
  170. {
  171. "sideEffects": false
  172. }
  173. ```
  174. ## Locales
  175. Added or updated locale support:
  176. - Croatian: [#5610](https://github.com/colinhacks/zod/pull/5610)
  177. - Greek: [#5840](https://github.com/colinhacks/zod/pull/5840)
  178. - Romanian: [#5657](https://github.com/colinhacks/zod/pull/5657)
  179. - Uzbek map support: [#5599](https://github.com/colinhacks/zod/pull/5599)
  180. - Georgian translation fix: [#5655](https://github.com/colinhacks/zod/pull/5655)
  181. - French issue origin translations: [#5845](https://github.com/colinhacks/zod/pull/5845)
  182. - Italian validation message updates: [#5852](https://github.com/colinhacks/zod/pull/5852)
  183. Locale message text changed in some cases, which may affect snapshots.
  184. ## Closed issues
  185. The following issues were closed by PRs included in this release:
  186. - Closed [#5466](https://github.com/colinhacks/zod/issues/5466) via [#5632](https://github.com/colinhacks/zod/pull/5632): preserve context immutability in parse functions.
  187. - Closed [#5617](https://github.com/colinhacks/zod/issues/5617) via [#5655](https://github.com/colinhacks/zod/pull/5655): correct Georgian translation for `string`.
  188. - Closed [#5619](https://github.com/colinhacks/zod/issues/5619) via [#5657](https://github.com/colinhacks/zod/pull/5657): add Romanian locale.
  189. - Closed [#5229](https://github.com/colinhacks/zod/issues/5229) via [#5661](https://github.com/colinhacks/zod/pull/5661): align object and tuple optionality handling.
  190. - Closed [#5680](https://github.com/colinhacks/zod/issues/5680) via [#5681](https://github.com/colinhacks/zod/pull/5681): respect `abort: true` in `.refine()` checks with `when`.
  191. - Closed [#5678](https://github.com/colinhacks/zod/issues/5678) via [#5699](https://github.com/colinhacks/zod/pull/5699): add missing `addIssue` to transform context.
  192. - Closed [#5717](https://github.com/colinhacks/zod/issues/5717) via [#5718](https://github.com/colinhacks/zod/pull/5718): avoid `delete` in `finalizeIssue`.
  193. - Closed [#5714](https://github.com/colinhacks/zod/issues/5714) via [#5719](https://github.com/colinhacks/zod/pull/5719): skip non-enumerable properties in record validation.
  194. - Closed [#5670](https://github.com/colinhacks/zod/issues/5670) via [#5723](https://github.com/colinhacks/zod/pull/5723): add discriminator `options` to invalid discriminator errors.
  195. - Closed [#5743](https://github.com/colinhacks/zod/issues/5743) via [#5744](https://github.com/colinhacks/zod/pull/5744): increase timeout for the datetime ReDoS checker test.
  196. - Closed [#5732](https://github.com/colinhacks/zod/issues/5732) via [#5758](https://github.com/colinhacks/zod/pull/5758): apply description and default metadata in `fromJSONSchema()`.
  197. - Closed [#5731](https://github.com/colinhacks/zod/issues/5731) via [#5759](https://github.com/colinhacks/zod/pull/5759): strip redundant `id` from `$defs` entries in JSON Schema output.
  198. - Closed [#5605](https://github.com/colinhacks/zod/issues/5605) via [#5763](https://github.com/colinhacks/zod/pull/5763): update `z.custom()` docs for v4 compatibility.
  199. - Closed [#5593](https://github.com/colinhacks/zod/issues/5593) via [#5769](https://github.com/colinhacks/zod/pull/5769): support `discriminatedUnion().encode()` with codec discriminators.
  200. - Closed [#5625](https://github.com/colinhacks/zod/issues/5625) via [#5770](https://github.com/colinhacks/zod/pull/5770): add codec inversion.
  201. - Closed [#5778](https://github.com/colinhacks/zod/issues/5778) via [#5779](https://github.com/colinhacks/zod/pull/5779): add custom docs 404 page.
  202. - Closed [#5792](https://github.com/colinhacks/zod/issues/5792) via [#5793](https://github.com/colinhacks/zod/pull/5793): correct floating-point `multipleOf()` validation.
  203. - Closed [#5777](https://github.com/colinhacks/zod/issues/5777) via [#5797](https://github.com/colinhacks/zod/pull/5797): resolve recursive lazy JSON Schema stack overflow.
  204. - Closed [#5805](https://github.com/colinhacks/zod/issues/5805) via [#5812](https://github.com/colinhacks/zod/pull/5812): fix self-referencing schema docs.
  205. - Closed [#5826](https://github.com/colinhacks/zod/issues/5826) via [#5855](https://github.com/colinhacks/zod/pull/5855): clone `Map` and `Set` defaults.
  206. - Closed [#5842](https://github.com/colinhacks/zod/issues/5842) via [#5856](https://github.com/colinhacks/zod/pull/5856): align `.merge()` refinement semantics with `.extend()`.
  207. - Closed [#4461](https://github.com/colinhacks/zod/issues/4461) and [#5414](https://github.com/colinhacks/zod/issues/5414) via [#5864](https://github.com/colinhacks/zod/pull/5864): honor `jitless` config in the eval probe.
  208. - Closed [#5868](https://github.com/colinhacks/zod/issues/5868) via [#5869](https://github.com/colinhacks/zod/pull/5869): handle empty `z.union([])` and `z.xor([])`.
  209. - Closed [#5296](https://github.com/colinhacks/zod/issues/5296) via [#5891](https://github.com/colinhacks/zod/pull/5891): apply key schema transforms in `z.record()`.
  210. - Closed [#5824](https://github.com/colinhacks/zod/issues/5824) via [#5893](https://github.com/colinhacks/zod/pull/5893): emit falsy prefault values in JSON Schema output.
  211. ## Commits
  212. - Commit [`44f6a03e`](https://github.com/colinhacks/zod/commit/44f6a03e1d7cd918bfb9d9962d967deb6718335b) fix(locales): correct Georgian translation for 'string' to 'ველი' ([#5655](https://github.com/colinhacks/zod/pull/5655)) by @tushargr0ver
  213. - Commit [`7b43bc64`](https://github.com/colinhacks/zod/commit/7b43bc64e7a2720fe66d6e99239c2a00c782e06b) docs(ecosystem): add Hono Takibi ([#5651](https://github.com/colinhacks/zod/pull/5651)) by @nakita628
  214. - Commit [`119376b9`](https://github.com/colinhacks/zod/commit/119376b9dc2e80f44bedd282702b46e18e2ee72c) feat: add map support to Uzbek locale ([#5599](https://github.com/colinhacks/zod/pull/5599)) by @uchkunr
  215. - Commit [`8fbf701e`](https://github.com/colinhacks/zod/commit/8fbf701e6c3770682803988bb20183f6628987da) test: add edge case tests for boundary values ([#5601](https://github.com/colinhacks/zod/pull/5601)) by @uchkunr
  216. - Commit [`f1f93c2b`](https://github.com/colinhacks/zod/commit/f1f93c2bca9984f844017c768183d2ea4b7c9cc4) Fix order of brand method examples in api.mdx ([#5604](https://github.com/colinhacks/zod/pull/5604)) by @onurtemiz
  217. - Commit [`10105ee4`](https://github.com/colinhacks/zod/commit/10105ee40f6aba0d89454c42a49554296cabf992) docs: Fix typos in json-schema documentation ([#5608](https://github.com/colinhacks/zod/pull/5608)) by @SaKaNa-Y
  218. - Commit [`2d367139`](https://github.com/colinhacks/zod/commit/2d3671390f6cae4254642cf9ac7f16783eb6ff20) feat: add hr translation ([#5610](https://github.com/colinhacks/zod/pull/5610)) by @vuki656
  219. - Commit [`54902cb7`](https://github.com/colinhacks/zod/commit/54902cb794f24f4ceb0cf8830e5a27b3490191f7) chore: update pullfrog.yml workflow
  220. - Commit [`89ba70f2`](https://github.com/colinhacks/zod/commit/89ba70f2d50d33a70549bedbd5c79785810ee21b) chore: add sideEffects false to stub package.json for tree-shaking ([#5689](https://github.com/colinhacks/zod/pull/5689)) by @jesse-holden
  221. - Commit [`eaa3c2c3`](https://github.com/colinhacks/zod/commit/eaa3c2c3633a5e6494d8ac03c14365d181794e71) Update positive checks to use alias `.gt(0)` in the docs ([#5671](https://github.com/colinhacks/zod/pull/5671)) by @Fredkiss3
  222. - Commit [`65f1f404`](https://github.com/colinhacks/zod/commit/65f1f404f644cfc9b7f790d310500a05b9d30ca4) fix typo ([#5676](https://github.com/colinhacks/zod/pull/5676)) by @Nikita0x
  223. - Commit [`5b574501`](https://github.com/colinhacks/zod/commit/5b5745014af2a3b0ea6339ccd7bbcbdf845f7181) fix: respect `abort: true` in `.refine()` for checks with `when` function ([#5681](https://github.com/colinhacks/zod/pull/5681))
  224. - Commit [`539de140`](https://github.com/colinhacks/zod/commit/539de140773587724723601720082a9231ba6d64) docs: fix README links for async refinements/transforms ([#5682](https://github.com/colinhacks/zod/pull/5682)) by @pavan-sh
  225. - Commit [`46cd10e7`](https://github.com/colinhacks/zod/commit/46cd10e76339c2f9cf8ad99df49b808e58e69879) docs: fix README anchor links for async APIs ([#5683](https://github.com/colinhacks/zod/pull/5683)) by @pavan-sh
  226. - Commit [`55747b3c`](https://github.com/colinhacks/zod/commit/55747b3cd05cd8b60b4f3d6a6348e2c508069c12) Remove deprecated downlevelIteration option ([#5684](https://github.com/colinhacks/zod/pull/5684)) by @RyanCavanaugh
  227. - Commit [`3a818de1`](https://github.com/colinhacks/zod/commit/3a818de145dc2fa9b5753bc8bf97b0b8484cfbaf) fix(v4): handle multi-digit exponents in floatSafeRemainder ([#5687](https://github.com/colinhacks/zod/pull/5687)) by @shakecodeslikecray
  228. - Commit [`3cd45ebc`](https://github.com/colinhacks/zod/commit/3cd45ebcbcf06a3f16e702a010074dfceca3ea50) fix(v4): add strict validation to `httpUrl()` ([#5672](https://github.com/colinhacks/zod/pull/5672)) by @LuckySilver0021
  229. - Commit [`7d98c909`](https://github.com/colinhacks/zod/commit/7d98c909329713cb2f478620f8a67aaf3ef40ce2) add Sanity as silver sponsor and Mintlify as bronze sponsor
  230. - Commit [`c7805073`](https://github.com/colinhacks/zod/commit/c7805073fef5b6b8857307c3d4b3597a70613bc2) move Sanity and Mintlify to top of sponsor lists
  231. - Commit [`bee2dc8d`](https://github.com/colinhacks/zod/commit/bee2dc8d4971a5142d6197a01426837e2a57f69d) docs: move `z.iso.time()` from format to pattern section ([#5696](https://github.com/colinhacks/zod/pull/5696))
  232. - Commit [`2f8414bc`](https://github.com/colinhacks/zod/commit/2f8414bc90cebc76be87c3640617e300a5d9b060) fix: add missing addIssue to transform context ([#5699](https://github.com/colinhacks/zod/pull/5699)) by @F-A-N-D-E
  233. - Commit [`d3c0ec87`](https://github.com/colinhacks/zod/commit/d3c0ec8764ede3aa7f7c7d47cb5fa985db15be20) docs: add note about removed `.errors` alias in v4 changelog ([#5705](https://github.com/colinhacks/zod/pull/5705)) by @togami2864
  234. - Commit [`fa338a3b`](https://github.com/colinhacks/zod/commit/fa338a3b885e6f8aeefc439b50982132ec0af1b5) fix(v4): JSON schema min/max intersection for draft-04 and openapi-3.0 ([#5700](https://github.com/colinhacks/zod/pull/5700)) by @ebroder
  235. - Commit [`3473b288`](https://github.com/colinhacks/zod/commit/3473b288e02d536252db517a4c51b5adc23603b4) chore: bump zshy to ^0.7.1
  236. - Commit [`cc8f9b7c`](https://github.com/colinhacks/zod/commit/cc8f9b7cb5674c0df03803d05b2a3a00569cdb07) docs: improve README wording and fix typos ([#5736](https://github.com/colinhacks/zod/pull/5736)) by @vedanshshetti
  237. - Commit [`f5336717`](https://github.com/colinhacks/zod/commit/f533671752ae7247bc25dca8f2dbfda80fa2fccc) feat: add json-up to ecosystem ([#5740](https://github.com/colinhacks/zod/pull/5740)) by @mrspence
  238. - Commit [`60ff3987`](https://github.com/colinhacks/zod/commit/60ff398771bb4b6df04d96f00b9a10ee561ee7af) fix(v4): preserve parent path when treeifying nested union/key/element issues
  239. - Commit [`08b14b51`](https://github.com/colinhacks/zod/commit/08b14b51501335a3e0de3cb92c3b2fdeae00a0d6) perf: avoid `delete` in `finalizeIssue` to keep V8 fast mode ([#5718](https://github.com/colinhacks/zod/pull/5718))
  240. - Commit [`9cf868d2`](https://github.com/colinhacks/zod/commit/9cf868d20cdaf4cf80f6d33a6eaf31582f1cdeba) fix(v4): treeify error nested union bug ([#5708](https://github.com/colinhacks/zod/pull/5708)) by @dstashevskyi
  241. - Commit [`28f39a6d`](https://github.com/colinhacks/zod/commit/28f39a6d97ce903ed0d2f6cd99a60d390faa7adf) Add JSONType export ([#5709](https://github.com/colinhacks/zod/pull/5709)) by @RobinVdBroeck
  242. - Commit [`65fab33e`](https://github.com/colinhacks/zod/commit/65fab33e287bba2db5942c7f9ad905ac98f62fce) feat: allow `when` parameter in `.superRefine()` ([#5741](https://github.com/colinhacks/zod/pull/5741)) by @vilvai
  243. - Commit [`7f87df1e`](https://github.com/colinhacks/zod/commit/7f87df1e8ae61679ed9dc3ba223572ce3d7bc716) refactor(v4): remove unnecessary type assertions ([#5720](https://github.com/colinhacks/zod/pull/5720)) by @chisaki66
  244. - Commit [`518f15dd`](https://github.com/colinhacks/zod/commit/518f15ddada3b5d959f4ff32b094789e2d85349a) Preprocess is not deprecated ([#5721](https://github.com/colinhacks/zod/pull/5721)) by @mxdvl
  245. - Commit [`2e5b23dc`](https://github.com/colinhacks/zod/commit/2e5b23dcd41eb257bda434b9997fd60a19cdf38f) fix: add options to invalid discriminator errors ([#5723](https://github.com/colinhacks/zod/pull/5723)) by @Danielchinasa
  246. - Commit [`7f789def`](https://github.com/colinhacks/zod/commit/7f789defd73ee35f3099ab5c2091cb19bd2b3578) fix: skip non-enumerable properties in record validation ([#5719](https://github.com/colinhacks/zod/pull/5719)) by @veeceey
  247. - Commit [`ee15fa19`](https://github.com/colinhacks/zod/commit/ee15fa1905f7c6626dea5f8dc880e66cdb4700ad) docs: add AGENTS notes for JSDoc, PR comments, and PR worktree workflow
  248. - Commit [`f52b4d28`](https://github.com/colinhacks/zod/commit/f52b4d288fabb03b98ff3f893c58e285eb310e96) Revert "docs: improve README wording and fix typos (#5736)"
  249. - Commit [`ddb41391`](https://github.com/colinhacks/zod/commit/ddb413916bc238e8d2d6ba67a2ce4b48ff2aa930) test: increase timeout for redos checker in datetime.test.ts ([#5744](https://github.com/colinhacks/zod/pull/5744)) by @rishadaufa
  250. - Commit [`bc07e459`](https://github.com/colinhacks/zod/commit/bc07e459bab4f895bf1c99f182c6841d577c16b3) docs: fix doc ([#5745](https://github.com/colinhacks/zod/pull/5745)) by @xgaia
  251. - Commit [`e06af5de`](https://github.com/colinhacks/zod/commit/e06af5de314f1cad8dfaa0a5f1909e21ffff9e49) Update Hey API description ([#5748](https://github.com/colinhacks/zod/pull/5748)) by @mrlubos
  252. - Commit [`28c156e2`](https://github.com/colinhacks/zod/commit/28c156e254ebdf65d9ed3de4caf1d4293f7e7a84) fix: apply description and default metadata to enum, const, and not schemas in fromJSONSchema ([#5758](https://github.com/colinhacks/zod/pull/5758)) by @mibragimov
  253. - Commit [`f457edf1`](https://github.com/colinhacks/zod/commit/f457edf1e504787eadfe2dffe51a77c64e3f0e17) Fix grammar in CONTRIBUTING.md ([#5765](https://github.com/colinhacks/zod/pull/5765)) by @siekmang
  254. - Commit [`411f6c64`](https://github.com/colinhacks/zod/commit/411f6c64e910c5e18799d0a7a09bcd7a4e40f23e) fix(v4): resolve stack overflow in toJSONSchema for recursive lazy with describe ([#5797](https://github.com/colinhacks/zod/pull/5797)) by @Hassad674
  255. - Commit [`45dd421e`](https://github.com/colinhacks/zod/commit/45dd421e72e989752fa5f85529dfbf50bdbd3f61) docs: add tone guidelines for issue and PR comments to AGENTS.md
  256. - Commit [`ddd20a30`](https://github.com/colinhacks/zod/commit/ddd20a300441d7cffd59821461ed0c2fe9c96bbc) test: align optional property assertions with actual inferred types
  257. - Commit [`a1cf8a93`](https://github.com/colinhacks/zod/commit/a1cf8a9312582591d9cdccdd677ba1d90e706cc0) docs: update z.custom example for v4 compatibility ([#5763](https://github.com/colinhacks/zod/pull/5763)) by @andrewdamelio
  258. - Commit [`b6a3b336`](https://github.com/colinhacks/zod/commit/b6a3b3369a5b9fdde9adde8203b96b71c0634ad5) fix: strip redundant id from `$defs` entries in toJSONSchema ([#5759](https://github.com/colinhacks/zod/pull/5759)) by @mibragimov
  259. - Commit [`c7a8ccc0`](https://github.com/colinhacks/zod/commit/c7a8ccc0d0fb4f2bd1c938b8d79873a8ebd6573e) fix: discriminatedUnion encode() with codec discriminator ([#5769](https://github.com/colinhacks/zod/pull/5769)) by @mahmoodhamdi
  260. - Commit [`87cf0f93`](https://github.com/colinhacks/zod/commit/87cf0f93cd0f34bdc69f11c9377568e6812841c4) fix(fromJSONSchema): normalize input via JSON round-trip
  261. - Commit [`7163e6f2`](https://github.com/colinhacks/zod/commit/7163e6f25ae8c90be79bd588417440c047ee30b0) feat: add `.invert()` method to ZodCodec ([#5770](https://github.com/colinhacks/zod/pull/5770)) by @mahmoodhamdi
  262. - Commit [`b59b9b13`](https://github.com/colinhacks/zod/commit/b59b9b13c20397389c5d4dc3a2ecbcd5e9349395) fix: replace `.default` with `.prefault` ([#5776](https://github.com/colinhacks/zod/pull/5776)) by @alanskovrlj
  263. - Commit [`93bba686`](https://github.com/colinhacks/zod/commit/93bba686325e09dced20da8d7bc18c7e61b71562) docs: add Zod AOT to ecosystem page ([#5806](https://github.com/colinhacks/zod/pull/5806)) by @wakita181009
  264. - Commit [`2564caa4`](https://github.com/colinhacks/zod/commit/2564caa440e690fd3ad58ce55fdff0fe073d6cc0) fix(docs): add custom 404 page with proper theme support ([#5779](https://github.com/colinhacks/zod/pull/5779)) by @WolfieLeader
  265. - Commit [`5b7ed214`](https://github.com/colinhacks/zod/commit/5b7ed214526cb5a7cc508aec236603ff79ae9579) fix: correct multipleOf float validation using tolerance-based comparison ([#5793](https://github.com/colinhacks/zod/pull/5793)) by @cyphercodes
  266. - Commit [`cc9139d2`](https://github.com/colinhacks/zod/commit/cc9139d209001bfdeb23dfe2d5b0262c02c950cf) docs: fix self-referencing schema in refine when() example ([#5812](https://github.com/colinhacks/zod/pull/5812)) by @claygeo
  267. - Commit [`0e960108`](https://github.com/colinhacks/zod/commit/0e960108f0d98dbea7844a8ff914f0980352f636) fix(v4): support v3-style single-arg z.record(valueType)
  268. - Commit [`41b25af9`](https://github.com/colinhacks/zod/commit/41b25af98f108d7b6f695576d4e0330b97252bfd) docs(agents): refine PR comment tone guidance
  269. - Commit [`4c03c20d`](https://github.com/colinhacks/zod/commit/4c03c20d2bc7e013e8b80ce55380cd4b82bfe352) Update Italian locale error messages for validation ([#5852](https://github.com/colinhacks/zod/pull/5852)) by @pastorello
  270. - Commit [`37ac1ba0`](https://github.com/colinhacks/zod/commit/37ac1ba0d694b3b80e22c006dc6e2b78b0c956dc) fix(fr): translate issue.origin in too_big/too_small errors ([#5845](https://github.com/colinhacks/zod/pull/5845)) by @Ouaziz-chedli
  271. - Commit [`345be203`](https://github.com/colinhacks/zod/commit/345be2039463516aaac90640c14de1b697e775b6) docs: add validex to ecosystem ([#5848](https://github.com/colinhacks/zod/pull/5848)) by @chiptoma
  272. - Commit [`3c1f32bd`](https://github.com/colinhacks/zod/commit/3c1f32bd280c01b836d4790981fd769cf9041d29) feat(locales/en): handle instanceof and add comprehensive locale tests
  273. - Commit [`888e52bb`](https://github.com/colinhacks/zod/commit/888e52bb1762f8a8b881af48d9f1bdc353372af8) feat(locales): add Greek (el) locale ([#5840](https://github.com/colinhacks/zod/pull/5840)) by @saileshbro
  274. - Commit [`bf6d99ed`](https://github.com/colinhacks/zod/commit/bf6d99ed76be86e4871d2381ecd9832293c13406) Revert "feat(locales/en): handle instanceof and add comprehensive locale tests"
  275. - Commit [`e8196a8d`](https://github.com/colinhacks/zod/commit/e8196a8d98e3bc3cc6714ef5ff34b5abf33eff4a) fix(resolution): align expected fr message with translated locale
  276. - Commit [`b6b12882`](https://github.com/colinhacks/zod/commit/b6b1288277e6ca87dab0ad1c7251b92612b7445c) correct logic for validating length ([#5843](https://github.com/colinhacks/zod/pull/5843)) by @nameearly
  277. - Commit [`34f60159`](https://github.com/colinhacks/zod/commit/34f601590351e5d3a57fe20c001155940ba65324) fix(v4): clone Map and Set in shallowClone to prevent shared state across `.default()` parses ([#5855](https://github.com/colinhacks/zod/pull/5855)) by @artur-seppa
  278. - Commit [`91a7d0d1`](https://github.com/colinhacks/zod/commit/91a7d0d1e0d3c8338e9fd92cf819cded87e8973f) fix(v4): reject whitespace in z.base64() to close atob bypass
  279. - Commit [`23edf484`](https://github.com/colinhacks/zod/commit/23edf4844bcd89fa37c549dab187ce7f86728540) Revert "fix(v4): reject whitespace in z.base64() to close atob bypass"
  280. - Commit [`15cafa13`](https://github.com/colinhacks/zod/commit/15cafa13940b7055cc21e4ef440a6a0c6b7af72b) fix(v4): throw on `.merge()` receiver with refinements; preserve refinements from second schema ([#5856](https://github.com/colinhacks/zod/pull/5856)) by @solssak
  281. - Commit [`584b1089`](https://github.com/colinhacks/zod/commit/584b1089e1fc7bfcc97797576eff8da85bcdf031) fix(v4): reject whitespace in z.base64() to close atob bypass ([#5888](https://github.com/colinhacks/zod/pull/5888)) by @colinhacks
  282. - Commit [`b9b62c65`](https://github.com/colinhacks/zod/commit/b9b62c65357c2b0fed4ae046a30c8e84e4094202) fix(core): honour `jitless` config in `allowsEval` probe ([#5864](https://github.com/colinhacks/zod/pull/5864)) by @dokson
  283. - Commit [`fffe99bd`](https://github.com/colinhacks/zod/commit/fffe99bdd7445cc072b5ed2d74b2a6204bdbc86c) fix(v4): construct empty unions instead of crashing ([#5869](https://github.com/colinhacks/zod/pull/5869)) by @tjenkinson
  284. - Commit [`285bde7f`](https://github.com/colinhacks/zod/commit/285bde7f43ca66938eeac38dea852256d4757336) feat(core): share `globalConfig` across module systems via `globalThis` ([#5889](https://github.com/colinhacks/zod/pull/5889)) by @colinhacks
  285. - Commit [`195e8696`](https://github.com/colinhacks/zod/commit/195e86962b5156012a4cdcfbff87dffddce87b78) perf(v4): mark top-level factory calls as `/*@__PURE__*/` for tree-shaking
  286. - Commit [`61d7bedb`](https://github.com/colinhacks/zod/commit/61d7bedb873bf8185162bb51d027fd8acf2710ee) fix(v4): apply key schema transforms in z.record() ([#5891](https://github.com/colinhacks/zod/pull/5891)) by @colinhacks
  287. - Commit [`45acd2ad`](https://github.com/colinhacks/zod/commit/45acd2ad78fb34ef61c5b72e9c03dfeaa432bef9) ci(release): switch to npm trusted publishing via OIDC ([#5890](https://github.com/colinhacks/zod/pull/5890)) by @colinhacks
  288. - Commit [`476ae243`](https://github.com/colinhacks/zod/commit/476ae243e86344af08d6c396deed082e83d7d7e1) Tighten cuid() regex and deprecate CUID v1 ([#5880](https://github.com/colinhacks/zod/pull/5880)) by @colinhacks
  289. - Commit [`6217527e`](https://github.com/colinhacks/zod/commit/6217527e4880054dda5e4d33aa12192a36a35062) docs(agents): document push-to-main footgun and version-bump rule ([#5883](https://github.com/colinhacks/zod/pull/5883)) by @colinhacks
  290. - Commit [`757f0b0f`](https://github.com/colinhacks/zod/commit/757f0b0f5217e0e7125478cd91af1e2c0cd21aa9) fix(v4): apply util.Writeable<T> in strictObject/looseObject for shape display parity ([#5882](https://github.com/colinhacks/zod/pull/5882)) by @colinhacks
  291. - Commit [`fa4a3740`](https://github.com/colinhacks/zod/commit/fa4a37404966d7ada0f5bb02ceeb592f1d4d9c52) fix(v4): apply util.Writeable in mini object constructors and extend/safeExtend/partial/required ([#5895](https://github.com/colinhacks/zod/pull/5895)) by @colinhacks
  292. - Commit [`ebc8287c`](https://github.com/colinhacks/zod/commit/ebc8287ca206402cf3a9aceb745b204493cbadfb) fix(v4): emit falsy prefault values in toJSONSchema ([#5893](https://github.com/colinhacks/zod/pull/5893)) by @mixelburg
  293. - Commit [`8fcb71a5`](https://github.com/colinhacks/zod/commit/8fcb71a5ffa5b32a508ac8bb38b7e1e13c387bf5) perf(v4): lazy-bind builder methods to shared internal prototype ([#5897](https://github.com/colinhacks/zod/pull/5897)) by @colinhacks
  294. - Commit [`76e8f706`](https://github.com/colinhacks/zod/commit/76e8f706bb554de82234106de8299d0139cb3b8e) fix(v4): skip `__proto__` key in object catchall ([#5898](https://github.com/colinhacks/zod/pull/5898)) by @colinhacks
  295. - Commit [`f0b0608e`](https://github.com/colinhacks/zod/commit/f0b0608ee300e609772405501ab4b219f0e19680) ecosystem: `eslint-plugin-zod-x` is `eslint-plugin-zod` now ([#5637](https://github.com/colinhacks/zod/pull/5637)) by @marcalexiei
  296. - Commit [`0b5c3bc2`](https://github.com/colinhacks/zod/commit/0b5c3bc2b9e095e06687d2381bdd741185fbfee9) docs: fix refinements examples in api.mdx ([#5649](https://github.com/colinhacks/zod/pull/5649)) by @playoffthecuff
  297. - Commit [`327e152e`](https://github.com/colinhacks/zod/commit/327e152e463c85e6404388738d397ed92e5f3999) docs(agents): refine PR comment tone guidance further
  298. - Commit [`57d80a82`](https://github.com/colinhacks/zod/commit/57d80a82bde8877f3eb79e5dad9786096c37490f) test(v4): pin object/tuple key optionality through optout propagation
  299. - Commit [`f19860f1`](https://github.com/colinhacks/zod/commit/f19860f1f17e3bdc3e696ee5290441bba093d7a4) fix: preserve context immutability in parse functions ([#5632](https://github.com/colinhacks/zod/pull/5632)) by @bgk614
  300. - Commit [`ec979ad7`](https://github.com/colinhacks/zod/commit/ec979ad783a9e9c992d3c9bd4e5f3b56110b1ef8) feat: add Romanian (ro) locale ([#5657](https://github.com/colinhacks/zod/pull/5657)) by @tushargr0ver
  301. - Commit [`b6066b3e`](https://github.com/colinhacks/zod/commit/b6066b3e4730fc8b966d13974b4abae8dce25df4) fix(v4): align object and tuple optionality handling ([#5661](https://github.com/colinhacks/zod/pull/5661)) by @Cyjin-jani
  302. - Commit [`ad0b8271`](https://github.com/colinhacks/zod/commit/ad0b82713e70e53707dd5e6497c9d922fcba3721) ci: update release workflow for trusted publishing
  303. - Commit [`6db607be`](https://github.com/colinhacks/zod/commit/6db607be3c218ad9f23fef8975de1f37469680e7) fix(release): keep JSR manifest publishable
  304. - Commit [`f778e02a`](https://github.com/colinhacks/zod/commit/f778e02a81842cbc40b1a448a85b29747227c49d) build: bump zshy for JSR wildcard exports

view on githubimported 2026-09-28 via npm