-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: add valibot$
validator and fix types of zod$
implementation
#6752
Conversation
🦋 Changeset detectedLatest commit: 47f7d60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This is a draft PR because it is missing docs and probably a few other things. I prefer to get a review and confirmation that this will be merged before finalizing this PR. |
Can you run |
LGTM - we could add it as an alpha preview feature in v1.8 IMHO, saying that we're looking for feedback |
Thank you for your review!
Will do this tomorrow.
Not sure if this is necessary but we can do it. |
commit: |
How quickly can this be merged? Should I continue with the documentation? |
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 think we can merge this as a new feature provided we're sure that the error output will not change later.
Then we'd have to have some tests that verify the error shape.
I think it straightforward enough to merge asap, it could be part of 1.8.0. Documentation would be great, please add some tests though, see https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/render/jsx/types/jsx-types.unit.tsx for examples on how to test types, as well as real tests for the error shape. |
Will do. Is it true that the Zod implementation is not tested, or am I just not finding the tests? |
indeed no tests currently, but added in #6720 |
Co-authored-by: Tobi <[email protected]>
c87183e
to
6f63fee
Compare
@wmertens does my last |
530f822
to
07131a7
Compare
07131a7
to
18fa5ee
Compare
Could you write it as a report of things changed instead? So not "I changed X to Y" but instead "X is now Y". |
@wmertens @fabian-hiller is there something I can help with? I need this isAny check in the types to upgrade qwik. We still hang on 1.5.6 with this neat JSX security issue. |
Feel free to take a look at the currently unresolved error shape implementation and share your thoughts on how to proceed: #6752 (review) I am also interested in merging this PR next week. |
Looks like this PR fixes type inference for zod validator, and if so, then it will solve this issue: #5784 |
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.
@fabian-hiller can you fix the key thing, I would than check it out in our large code base again.
I will try to go over everything in the next few days and share my thoughts on how to proceed. |
@wmertens I have thought about this PR and think it is best if we mark the new |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
@wmertens I am not sure what to do with the tests. This is because the type |
My current recommendation is to review and merge this PR as is. I plan to create another PR for Qwik City v2 that will change the error formatting to the native output, further improve the types, and add unit and type tests. |
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.
👍 🤠 👍
…#6752) * feat: add valibot$ validator and fix types of zod$ implementation * fix: brand typed data validators * fix: update API documentation of Qwik City * feat: copy code from PR #6720 to merge PRs Co-authored-by: Tobi <[email protected]> * fix: document change with changeset * chore: change version declaration of Valibot dependency * chore: change version declaration of Valibot dependency * fix: change text of changeset * chore: Add alpha preview warning to valibot$ API --------- Co-authored-by: Tobi <[email protected]>
Happy to report this is working as I had hoped it would last year. Thank you @fabian-hiller for seeing it over the finish line! 🥳 |
This is working really well. When's it going to be out of experimental? |
I am not sure it will ever be. Maybe a In this way, Qwik could provide a single and unified function to simplify implementation and maintenance with an improved DX for users. But It's great that you ask because we should discuss this to figure out what's best in the long run. |
Overview
Adds Valibot support with a
valibot$
validator similarly to how Zod is supported withzod$
.Related #4998, Credits @brandonpittman
What is it?
Description
The current implementation of
zod$
used type casting. I have fixed the types and solved the problems that led to the current type-casting solution. I also added support for my library Valibot with avalibot$
validator that works similarly to thezod$
validator.Checklist: