Response Parsing/Validation Library

Does someone have a recommendation for a Response Parsing/Validation library that parses the Server response I get in my client to make sure it conforms to what I expected? I know I can build something like that myself using zod, but I'd like to know if there is an existing library for that. I know zodios can be used client side only, but I am looking for alternatives without a server part.
6 Replies
Sturlen
Sturlen8mo ago
I suggest adding some more information about what frameworks you're using for the server and client, as well as if you own the backend or if it's external
kwargs
kwargsOP8mo ago
@Sturlen Should be framework-agnostic, and I said I want it only client side. The server is a plain REST API I am using React though
Neto
Neto8mo ago
zod is powerful but has a giant bundle increase valibot seems more aligned with that you want to do
kwargs
kwargsOP8mo ago
I already have zod in my bundle so that's not that big of deal. I am basically looking for a higher abstraction based on something like zod for the use case of parsing api calls Just using bare fetch with zod works but it's not a nice DX
Neto
Neto8mo ago
zod is already the top abstraction anything higher is just at framework level
kwargs
kwargsOP8mo ago
https://ts-rest.com/ might be what I am looking for actually. I'd like the lib to focus on the client part, but ts rest seems to at least offer a package without the server part
🪄 | ts-rest
Incrementally adoptable type-safety for your new and existing APIs
Want results from more Discord servers?
Add your server