Skip to content

Require minimum zod version 3.25.35#2679

Merged
RobinTail merged 2 commits intomasterfrom
drop-zod-before-3.25.35
May 29, 2025
Merged

Require minimum zod version 3.25.35#2679
RobinTail merged 2 commits intomasterfrom
drop-zod-before-3.25.35

Conversation

@RobinTail
Copy link
Copy Markdown
Owner

@RobinTail RobinTail commented May 29, 2025

Since stable v24.0.0 is not yet released, I decided to use that opportunity to avoid the mess and elevate the min zod version to the patch that made a breaking change.

Summary by CodeRabbit

  • Chores

    • Updated the minimum required version of the "zod" dependency to 3.25.35.
  • Refactor

    • Streamlined internal logic for union schema depiction, removing legacy compatibility code. No changes to public interfaces.

@RobinTail RobinTail added dependencies Pull requests that update a dependency file breaking Backward incompatible changes labels May 29, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2025

Walkthrough

The changes update the minimum required version of the zod dependency from 3.25.1 to 3.25.35 in both the changelog and package configuration. Additionally, the internal logic of the depictUnion function in the documentation helpers is streamlined by removing legacy compatibility code and simplifying the handling of union discriminators.

Changes

File(s) Change Summary
CHANGELOG.md Updated changelog to reflect the new minimum required zod version (3.25.35) and import requirements.
express-zod-api/package.json Updated the zod peer dependency version to ^3.25.35.
express-zod-api/src/documentation-helpers.ts Simplified depictUnion by removing legacy compatibility code and streamlining discriminator logic.

Poem

A hop and a skip, dependencies grow,
Zod’s new version now runs the show!
Legacy checks, we bid you goodbye,
Code is now cleaner, oh my oh my!
With docs more precise and helpers anew,
This rabbit’s quite proud of what we now do.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8c2d9f and 46f2431.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • express-zod-api/package.json (1 hunks)
  • express-zod-api/src/documentation-helpers.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
CHANGELOG.md (1)

undefined

<retrieved_learning>
Learnt from: RobinTail
PR: #2546
File: express-zod-api/tests/form-schema.spec.ts:31-31
Timestamp: 2025-05-27T19:27:13.462Z
Learning: Zod version 3.25.0 and later expose the Zod v4 API through the special import paths "zod/v4" and "zod/v4/core", allowing v4 features like .loose() to be used even when the package.json dependency shows a 3.x version.
</retrieved_learning>

🔇 Additional comments (7)
express-zod-api/package.json (2)

79-79: Peer dependency bump for zod is correct
The zod peer dependency has been updated from ^3.25.1 to ^3.25.35, aligning precisely with the breaking change introduced in the patch release and the upcoming 24.0.0 release requirements.


1-140: Ensure lockfile is regenerated
After bumping the peer dependency, please regenerate and commit the corresponding lockfile (yarn.lock or package-lock.json) to ensure consistent installs and prevent version mismatches in CI or downstream projects.

CHANGELOG.md (4)

8-8: Update minimum Zod version to 3.25.35
This aligns the documented requirement with the bump in the peer dependency and ensures that the patch release containing the breaking change is enforced.


55-56: Switch import to zod/v4
Good catch—examples now reference the zod/v4 entrypoint, which is required to leverage the Zod 4 API surface when using v3.25.35+.


60-64: Reposition .example() before .transform()
This change adheres to the new behavior where .example() must be called prior to .transform() for input schemas, matching the migration note in the changelog.


67-73: Update proprietary schema examples
The transition from ez.dateIn().example() to ez.dateIn({ examples: [...] }) and replacement of ez.file(...) with z.base64()/ez.buffer() correctly reflects the new API surface.

express-zod-api/src/documentation-helpers.ts (1)

117-118: LGTM! Clean refactor aligned with dependency upgrade.

The removal of legacy backward compatibility code is appropriate given the minimum zod version bump to 3.25.35. The simplified logic directly uses the propValues property instead of checking for the older disc property, making the code cleaner and easier to maintain.

The logic correctly:

  1. Returns the original jsonSchema if propValues doesn't exist
  2. Extracts the discriminator property name using the last key from propValues
  3. Maintains the existing discriminator assignment logic
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@RobinTail RobinTail added this to the v24 milestone May 29, 2025
@RobinTail RobinTail marked this pull request as ready for review May 29, 2025 18:14
@RobinTail RobinTail merged commit de4e8d2 into master May 29, 2025
15 checks passed
@RobinTail RobinTail deleted the drop-zod-before-3.25.35 branch May 29, 2025 18:16
@coderabbitai coderabbitai Bot mentioned this pull request Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Backward incompatible changes dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant