remix-params-helper
remix-params-helper copied to clipboard
Support for `yup`
yup is a very popular alternative to Zod. Is there any way we can use it as an alternative?
Would be very cool to make the validation pluggable, so we could write our own validation extensions. I'd like to use valibot for example, and arktype looks pretty good. Tons of great options.
Although I don't think it would be difficult to support other validation libraries, there are some challenges.
Zod didn't have the coerce
methods when I first wrote this. I wanted a simple way to ensure that strings were automatically converted to numbers and booleans as needed without manually adding the refinements in each schema.
You'll see there is code to walk the Zod schema to handle the necessary conversions. That's why it doesn't support all the features of Zod.
Last I looked valibot
didn't have a way to inspect the schema as it's simply a set of nested functions.
Last I looked valibot didn't have a way to inspect the schema as it's simply a set of nested functions.
Okay, didn't know that. The small bundle size comes with some limitations I guess.