Skip to content

migrate to zod v4#53

Merged
joshunrau merged 13 commits intomainfrom
zod-v4
May 30, 2025
Merged

migrate to zod v4#53
joshunrau merged 13 commits intomainfrom
zod-v4

Conversation

@joshunrau
Copy link
Collaborator

@joshunrau joshunrau commented May 30, 2025

Summary by CodeRabbit

  • Chores

    • Updated all imports to use the zod/v4 path for improved compatibility and consistency.
    • Upgraded dependencies: zod and @douglasneuroinformatics/libjs to newer versions.
  • Refactor

    • Replaced usage of z.TypeOf and z.infer with z.output in type annotations and type aliases for more accurate type extraction from Zod schemas.
    • Refined type constraints and signatures in public APIs, especially for validation, environment, and authentication schemas.
  • Bug Fixes

    • Improved type safety in configuration and validation schemas by enforcing stricter key and value constraints.

@joshunrau joshunrau merged commit 77046e6 into main May 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes update all imports of the Zod library to use the explicit 'zod/v4' subpath and replace usages of z.TypeOf/z.infer with z.output throughout the codebase. Several type signatures and constraints are updated accordingly. Dependency versions in package.json are also incremented. No runtime logic is altered.

Changes

Files / Areas Change Summary
example/app.ts, example/cats/schemas/cat.schema.ts, src/modules/auth/auth.module.ts, src/modules/auth/auth.config.ts, src/modules/auth/__tests__/auth.module.spec.ts, src/pipes/__tests__/parse-schema.pipe.test.ts, src/pipes/__tests__/validation.pipe.test.ts, src/utils/__tests__/validation.utils.test.ts, src/schemas/mongo-stats.schema.ts Changed Zod import path from 'zod' to 'zod/v4'
package.json Updated zod peer dependency from ^3.22.6 to ^3.25.x and upgraded @douglasneuroinformatics/libjs dependency
src/app/app.factory.ts, src/modules/auth/auth.config.ts, src/modules/auth/auth.module.ts, src/schemas/env.schema.ts, src/utils/env.utils.ts, src/utils/validation.utils.ts, src/mixins/data-transfer-object.mixin.ts, src/decorators/validation-schema.decorator.ts Updated type signatures to use z.output instead of z.TypeOf/z.infer; adjusted type constraints and generics as needed
src/meta/load.ts Changed Zod import, refined schema property types for esbuildOptions, onComplete, and globals
src/decorators/__tests__/validation-schema.decorator.test.ts, src/mixins/__tests__/data-transfer-object.mixin.test.ts Updated Zod import and type assertions in tests
src/pipes/parse-schema.pipe.ts Changed Zod import and updated type annotation for constructor parameter and property

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant Zod as Zod Schema (v4)
    participant Utils as Utility Functions

    App->>Zod: Import schema using 'zod/v4'
    Utils->>Zod: Use z.output<T> for type extraction
    App->>Utils: Parse and validate data with updated types
    Utils-->>App: Return validated and typed output
Loading

Suggested labels

released

Poem

Zod takes a leap, from old to new,
Version four now shining through!
Types refined, outputs clear,
No more TypeOf lurking here.
With imports neat and schemas tight,
The codebase glows—a tidy sight!
🚀✨


📜 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 813a732 and c5dd7d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • example/app.ts (1 hunks)
  • example/cats/schemas/cat.schema.ts (1 hunks)
  • package.json (2 hunks)
  • src/app/app.factory.ts (3 hunks)
  • src/decorators/__tests__/validation-schema.decorator.test.ts (2 hunks)
  • src/decorators/validation-schema.decorator.ts (1 hunks)
  • src/meta/load.ts (2 hunks)
  • src/mixins/__tests__/data-transfer-object.mixin.test.ts (1 hunks)
  • src/mixins/data-transfer-object.mixin.ts (2 hunks)
  • src/modules/auth/__tests__/auth.module.spec.ts (1 hunks)
  • src/modules/auth/auth.config.ts (2 hunks)
  • src/modules/auth/auth.module.ts (2 hunks)
  • src/pipes/__tests__/parse-schema.pipe.test.ts (1 hunks)
  • src/pipes/__tests__/validation.pipe.test.ts (2 hunks)
  • src/pipes/parse-schema.pipe.ts (1 hunks)
  • src/schemas/env.schema.ts (2 hunks)
  • src/schemas/mongo-stats.schema.ts (1 hunks)
  • src/utils/__tests__/validation.utils.test.ts (1 hunks)
  • src/utils/env.utils.ts (2 hunks)
  • src/utils/validation.utils.ts (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.

@joshunrau joshunrau deleted the zod-v4 branch May 30, 2025 20:44
@github-actions
Copy link

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant