Skip to content

chore(deps): Update zod to v4.4.3#332

Merged
so0k merged 2 commits into
open-constructs:mainfrom
X-Guardian:chore/bump-zod
Jul 14, 2026
Merged

chore(deps): Update zod to v4.4.3#332
so0k merged 2 commits into
open-constructs:mainfrom
X-Guardian:chore/bump-zod

Conversation

@X-Guardian

Copy link
Copy Markdown
Contributor

Description

Bumps zod from 3.25.76 to 4.4.3 (latest) in both packages that declare it, @cdktn/hcl2cdk and @cdktn/cli-core.

This is a major version bump (3.x → 4.x) and required migrating three removed/changed APIs across the schema definitions:

  • z.record(V)z.record(z.string(), V). v4 requires an explicit key type; the single-argument form no longer typechecks. Updated every call site in schema.ts, terraform-json.ts, local-provider-constraints.ts, models/schema.ts and dependencies/package-manager.ts.
  • .nonstrict().loose(). The .nonstrict() alias for unknown-key passthrough was removed; .loose() is the v4 equivalent.
  • .deepPartial() → per-level .partial(). .deepPartial() was removed with no direct replacement, so each nesting level is now made partial explicitly. To keep parsing behaviour identical I reproduced v3's exact recursion rules: .deepPartial() recursed into plain nested objects and array elements (those get .partial()) but not into z.record() values — so record value objects such as required_providers and npm dependencies keep their fields required, as they were on v3.
  • ZodError.errorsZodError.issues. The .errors accessor was renamed. Updated the two error-logging sites in output.ts and hcl2cdk/index.ts.

No string-format helpers (z.string().email() etc.) are used, so those v4 relocations don't apply here.

The migrated schemas were checked against both the installed v3 and v4 copies to confirm they parse identically — same output on valid input, same unknown-key passthrough, and the same rejection of a missing required field. tsc --noEmit passes cleanly on both packages.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

@X-Guardian X-Guardian marked this pull request as ready for review July 14, 2026 13:23
@X-Guardian X-Guardian requested a review from a team as a code owner July 14, 2026 13:24
@so0k so0k merged commit c10ee35 into open-constructs:main Jul 14, 2026
259 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants