-
Notifications
You must be signed in to change notification settings - Fork 10
Support for zod v4.x #23
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bc210d4
feat: added zod4 support, wip
5267b9f
chore: prettier
8c52756
fix: support zod 4 only
51b52c0
fix: removed wrong exports / imports
e27a21f
chore: reorganized files
6e19f72
chore: adjusted dependencies
84d69db
chore: removed error map
7258773
fix: avoid some castings; moved exception handlers to inline
3575c94
fix: add direct support for `deprecation` through meta, adjusted type…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| __snapshots__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`reporter should test the error output 1`] = ` | ||
| "Errors found while parsing environment: | ||
| [CONFIG_OBJECT]: This is a very special object that holds configuration. | ||
| ✖ Invalid input: expected string, received number | ||
| → at a | ||
| ✖ Invalid input: expected number, received undefined | ||
|
BowlingX marked this conversation as resolved.
|
||
| → at b | ||
| ✖ Invalid input: expected string, received number | ||
| → at c.d | ||
| (received "{\\"a\\":123,\\"c\\":{\\"d\\":21}}") | ||
|
|
||
| [FOO]: | ||
| ✖ Invalid input: expected number, received string | ||
| (received "bar") | ||
|
|
||
| [SOME_WITH_DEPRECATED_DESCRIPTION]: Some description | ||
| ✖ Invalid input: expected string, received undefined | ||
| (received undefined) | ||
|
|
||
| [SOME_WITH_DEPRECATED_DESCRIPTION_AND_NEW_DESCRIPTION]: New description | ||
| ✖ Invalid input: expected string, received undefined | ||
| (received undefined) | ||
|
|
||
| [PORT]: | ||
| ✖ Too big: expected number to be <=65535 | ||
| (received undefined) | ||
| (used default of 70000) | ||
| " | ||
| `; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import * as z from "zod"; | ||
| import * as z from "zod/v4"; | ||
|
|
||
| export const port = () => z.number().int().nonnegative().lte(65535); | ||
|
|
||
| export const deprecate = () => | ||
| z | ||
| .undefined({ invalid_type_error: "This var is deprecated." }) | ||
| .undefined({ error: "This var is deprecated." }) | ||
| .transform(() => undefined as never); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the formatter a bit to closer match what zod's
prettifyErroroutputs. We did not had any test before how the output looks like, so the test covers that.