-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Compare with zod #2430
Compare with zod #2430
Conversation
|
Feature-wise, with the previous wording, it seems that the scheme is in a weak position, but this is not the case. |
1. `schema` transformations are bidirectional, so it not only decodes like `zod` but also encodes. | ||
2. `schema` is integrated with `Effect` and inherits some benefits from it (such as dependency tracking in transformations). | ||
3. `schema` is highly customizable through annotations, allowing users to attach meta-information. | ||
4. `schema` uses a functional programming style with combinators and transformations (while `zod` provides a chainable API). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid mentioning FP at any cost, IMHO 😅
4. `schema` uses a functional programming style with combinators and transformations (while `zod` provides a chainable API). | |
4. `schema` provides many combinators and transformations making it highly composable (while `zod` provides a chainable API). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But with my suggestion, I'm not sure how composability contrasts with the chainable API because you can compose stuff through chaining, too.
The downside is that chainable APIs are not tree-shakable because the methods are attached to the objects prototype itself. schema
may result in much smaller bundle size compared to zod
, which is something frontenders will appreciate. But this needs to be verified in practice, I haven't done that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that schema will include the Effect runtime the smaller bundle size will only materialize in extreme use cases, wouldn't make such argument. What we can safely say is that chainable APIs can't be extended due to lack of extension functions in JS / TS, pipeable APIs can be extended as they are just composition of functions
I might have put this at the beginning of the README, but to be safer opted for just before the 'Documentation' heading.
Type
Description
To help newbies like me understand the differences between effect schema and similar projects. This comparison page could be a useful example for a more complete comparison.
Related
Closes #2406.