My thoughts after 4 months of using this library #1833
tyleralbee
started this conversation in
General
Replies: 2 comments 3 replies
-
Thank you for the feedback, @tyleralbee , I highly appreciate it.
Could you please clarify what kind of errors is it about, some example would be helpful.
Glad to inform you, that I'm going to make it cleaner in the upcoming v20. Here is an example. In case you meant something else, please clarify (with an example) what exactly should be made cleaner. new ResultHandler({
positive: (data) => ({
statusCodes: [201, 202],
schema: z.object({ status: z.literal("created"), data }),
}),
negative: [
{
statusCode: 409,
schema: z.object({ status: z.literal("exists"), id: z.number().int() }),
},
{
statusCodes: [400, 500],
schema: z.object({ status: z.literal("error"), reason: z.string() }),
},
],
handler: () => {},
}); |
Beta Was this translation helpful? Give feedback.
3 replies
-
Good news, @tyleralbee , now you can: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This library is my favorite abstraction on top of express. I originally went looking for a more coherent way to integrate validation into the request lifecycle. In giving this library a try, I ended up with more than that. The incredibly dedicated and talented maintainer has clearly put thought into where express may fall short (for lack of better phrasing; it is OK that express is unopinionated).
About 4 months ago, I posted a thread looking to gauge the long-term viability of using this library. On that post, and just about every post/issue I have seen, the maintainer responds just about immediately. Most maintainers of OSS go unthanked, and I wanted to start off by saying thank you.
For anyone considering this library as I was, I want to share some of the things I love about using this library. After that, I will give a couple suggestions.
This library is great because:
I believe this library is an example of when opinionated is done right. A small thing that I love is the choice made to force best practice in response structure out of the box. But, over everything else, I believe the way this library ties validation into the request/response lifecycle is its greatest strength.
There are always things that can be done better. Here's what I would like to see (I am happy to help where I can):
Thanks for the hard work.
Beta Was this translation helpful? Give feedback.
All reactions