remix-params-helper icon indicating copy to clipboard operation
remix-params-helper copied to clipboard

Support for `yup`

Open moishinetzer opened this issue 1 year ago • 3 comments

yup is a very popular alternative to Zod. Is there any way we can use it as an alternative?

moishinetzer avatar Mar 02 '23 16:03 moishinetzer

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.

hilja avatar Jan 20 '24 13:01 hilja

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.

kiliman avatar Jan 22 '24 16:01 kiliman

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.

hilja avatar Jan 24 '24 12:01 hilja