Skip to content
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

vs Yup #19

Closed
lishine opened this issue Mar 18, 2020 · 1 comment
Closed

vs Yup #19

lishine opened this issue Mar 18, 2020 · 1 comment

Comments

@lishine
Copy link

lishine commented Mar 18, 2020

Hi,

I have read your article and reasoning for creating this lib. And I first, ye cool correct types, I will use it.
But then I see that

  1. Is a fraction of yup features
  2. json-schema could be converted to yup
  3. With yup I can insert custom messages
  4. I can do required('this is required')

My question, where do you use it, so you can live without the above features?

@colinhacks
Copy link
Owner

To address your points in order:

  1. Zod is definitely missing lots of validation checks that Yup has. For instance, yup.number().positive(). For Zod's v1, I was only concerned with representing/validating types with an equivalent representation in TypeScript's type system. There is no way to represent a "positive number" type in TypeScript. But I certainly intend to implement a wider array of validators down the road.

  2. Not interested in this - the point of something like Zod is to avoid dealing with JSON-based schema declarations and their associated fragile codegen-based ecosystems.

  3. I like the custom messages concept from Yup. The API of Zod is flexible enough to support something like this in the future. I'll add it to the list.

  4. Seems like a subset of Branded types #3.

None of these strike me as particularly vital features. I'm using Zod in production on a commercial project, and it gets the job done. 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants