-
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 support with valibot$
to qwik-city
#4998
Conversation
|
✅ Deploy Preview for qwik-insights canceled.
|
Thanks for your nice PR, can you add the documentation for this please? |
Sure. Not done, yet. Will update docs tomorrow! Just wanted to share what I had so far. @fabian-hiller Is there a way with Valibot to check if a value is an ObjectSchema at runtime? |
@brandonpittman yes, this should work via the And via |
Note that you must also include |
It's not clear if we need async support. I've updated my PR with working code that satisfies TypeScript. I've removed any async types though. Can you take a look, please? |
Since the validation is done in an async function, we could enable async validation with |
If you want to add async support, you need to replace |
Okay. Will update it. Thanks. |
You must not remove |
Should I use Do I need to do something like |
Thanks for working on this! ❤️ |
I think I would write
This is not required. |
So I tried to build it locally but the demo files are failing to build. Something is off from your types... Not sure how you are building it but here is my process
What kind of help do you need from me to move this forward? |
I'll probably finally get around to thoroughly reviewing this PR this weekend. I will then commit directly to the PR and make improvements. I hope that this is possible without special permissions, since I am not an official maintainer of the Qwik repo. |
@brandonpittman a update for you. I have not forgotten about this PR and will finish it as soon as possible. We are currently working on a major structural change to Valibot. As soon as this is done, I will working on this PR. |
So the current state is that @fabian-hiller will make changes when he finds the time, right? |
Yes, this is the current state. But everyone is welcome to continue working on it before I find the time. In about 3 weeks I will be able to fully focus on my open source work again and will probably finish the PR before Christmas. |
I plan to work on and finalize this PR by the end of next week. |
I am very sorry that this is taking so long. I expect to finalize this PR next week. |
Thanks @fabian-hiller ! can't wait! |
Other things came up that I wanted to preordain. This PR is on my list for the next two weeks. |
There is a Valibot PR I want to review and maybe merge before I finish this implementation because some types may change. I will give an update here in a few days. |
Sorry to push this implementation back again. You may have seen this discussion on Twitter or GitHub. I plan to work on this first, as some types may change. |
Short update: I am basically rewriting Valibot at the moment. I am trying to improve the API design, performance, bundle size and types, but this will take some time. I also have to rewrite the documentation. I don't want to make any more promises about the timing of this PR. As soon as I feel ready, I will finish the implementation. |
The funny thing is: the implementation works. It’s just the types I wanted help with. I didn’t understand the types the original implementation had—because they assumed Zod was being used. |
I expect a lot of breaking changes for the next release. So even though the implementation of this PR is almost done, it might make sense to wait to not confuse people. |
@fabian-hiller Can you tell me what is going to change with Valibot that might affect this? The feature worked, it’s just the types that didn’t work. I’m gonna take a stab at fixing the types again. (Making the action types less Zod-specific in another PR first might be better though.) |
@brandonpittman I spoke with him recently, there's a lot of changes to the API coming, as I understand it. So that zod decoupling first send like a good idea |
The API will be mostly the same (except for the new |
@brandonpittman Are you still working on this or is it abandoned? |
JS works but couldn’t get any assistance getting the types to work from the original Zod implementation writer. Valibot author too busy with upgrades in the core library to look at it. Seemed only important to me but I’m not good enough with TypeScript to make the types work. |
I'm so sorry for that @brandonpittman |
I still plan to finish this PR, but unfortunately I had to give other things, like rewriting Valibot and updating our docs, a higher priority. I think Valibot is on a pretty good track to reach v1 RC in August. I also plan to work more with Qwik soon. Therefore, I hope to be able to work on it in the next two months. However, everyone should feel welcome to take over this PR to speed up the process. I am happy to answer questions and review everything. |
I have reviewed the |
@fabian-hiller You mean my fixes or the original implementation? |
The original implementation. |
Overview
Adds Valibot support with a
valibot$
function similarly to how Zod is supported byzod$
.Fixes #4924
What is it?
Description
Requires:
valibot
Use cases and why
So you can use Valibot to validate your actions
Checklist: