airjp73 / rvf

Easy form validation and state management for React and Remix
https://rvf-js.io
MIT License
839 stars 66 forks source link

Valibot Adapter #383

Closed scythewyvern closed 2 months ago

scythewyvern commented 2 months ago

This PR contains a new validation library - Valibot

I also have questions:

Are additional tests needed?

Maybe I missed something or did something wrong?

What should be returned in case of multiple errors (valibot has pipe and returns an array of errors for each pipe step)? Currently I always get only first error message from array.

Valibot issues guide

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
remix-validated-form ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 1:39pm
remix-validated-form-docs-v2 ❌ Failed (Inspect) Aug 28, 2024 1:39pm
scythewyvern commented 2 months ago

Since the tests are passing, it looks like we're getting all the errors we need. If there's a specific case you're worried about, let's add a test case for that.

actually it isn't a problem because rvf requires a single string for error message

let's look at this schema:

v.pipe(
  v.string(), // should be a string | first we get this error
  v.minLength(3), // should be at least 3 characters long | then we get this
  v.endsWith('foo') // should end with `foo` | and finally we get this
)

some libraries can handle error messages array, so we can show all of then at once

airjp73 commented 2 months ago

Thank for the work you put into this!

airjp73 commented 2 months ago

@rvf/valibot is now published 🎉