Skip to content

feat(zod): In v4, object().strict() is deprecated, use strictObject() instead. #2068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

soartec-lab
Copy link
Member

@soartec-lab soartec-lab commented Apr 29, 2025

Status

READY

Description

fix #2042

In zod v4, object().strict() is deprecated, use strictObject() instead.

https://v4.zod.dev/v4/changelog#deprecates-strict

// Zod 3
z.object({ name: z.string() }).strict();
 
// Zod 4
z.strictObject({ name: z.string() });

Related PRs

none

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

You can check this in the unit test I added.

@soartec-lab soartec-lab added enhancement New feature or request zod Zod related issue labels Apr 29, 2025
@soartec-lab soartec-lab added this to the 7.10.0 milestone Apr 30, 2025
@soartec-lab soartec-lab force-pushed the feat/zod/v4-compatible-strict-object branch from 71c52f5 to bd5f916 Compare April 30, 2025 02:04
@soartec-lab soartec-lab marked this pull request as ready for review April 30, 2025 02:04
@soartec-lab
Copy link
Member Author

This change may not be necessary, so change it to draft.

@soartec-lab soartec-lab marked this pull request as draft May 1, 2025 00:41
@soartec-lab soartec-lab marked this pull request as ready for review May 7, 2025 10:38
@soartec-lab
Copy link
Member Author

strict is not scheduled for removal in the future, but they strongly recommend not using it, and we follow suit.

Ref:

@soartec-lab soartec-lab merged commit 027ded8 into orval-labs:master May 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request zod Zod related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Zod 4 (now in beta)
2 participants