-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Added Zod integration (closes #1159) #1169
Merged
Conversation
This file contains 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
github-actions
bot
added
Area: Docs
Affects the documentation or reproductions seed
Area: Infra
Affects the repository itself (e.g., CI, dependencies)
labels
Oct 4, 2022
radekmie
added
Type: Feature
New features and feature requests
Area: Bridge
Affects some of the bridge packages
labels
Oct 4, 2022
Codecov Report
@@ Coverage Diff @@
## master #1169 +/- ##
==========================================
+ Coverage 98.49% 98.54% +0.05%
==========================================
Files 228 231 +3
Lines 3643 3769 +126
Branches 948 997 +49
==========================================
+ Hits 3588 3714 +126
Misses 4 4
Partials 51 51
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
wadamek65
previously approved these changes
Oct 13, 2022
kestarumper
requested changes
Oct 14, 2022
kestarumper
approved these changes
Oct 18, 2022
wadamek65
approved these changes
Oct 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: Docs
Affects the documentation or reproductions seed
Area: Infra
Affects the repository itself (e.g., CI, dependencies)
Bridge: Zod
Affects the uniforms-bridge-zod package
Type: Feature
New features and feature requests
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.
In this pull request, I added a new package:
uniforms-bridge-zod
, closing #1159. The implementation is really straightforward and documented in a step-by-step tutorial on my blog: "On uniforms Integration With Zod".Open topics:
ZodBridge
constructor.ZodError
the only accepted error format? I think it does - it's well documented and typed. But maybe we should handle others as well?getErrorMessages
? Right now it does the same thing asgetErrorMessage
, resulting in messages like "Value should be greater than or equal to 10000" which makes sense for inline errors, but doesn't work for theErrorsField
component.maxCount
/minCount
for arrays andmax
/min
/step
for numbers. I'm thinking about things like.email()
for string schemas being mapped totype: 'email'
. It may be handy for some themes but problematic in others.ZodBridge
and extending thegetProps
function.I've marked is at v3.x, but I'd rather see it as a v4.0 beta thing, due to bridge methods (see comments in the code).