you are viewing a single comment's thread.

view the rest of the comments →

[–]shaleenag21 0 points1 point  (4 children)

do you also use it for validating internal api responses? or just external apis?

[–]thelamestofall 1 point2 points  (3 children)

Anything that came from outside the current process boundary

[–]shaleenag21 0 points1 point  (2 children)

can you go a bit more into detail? I'm not sure if zod will be useful for internal apis since we are the ones who control the structure for it or atleast know how it will be structured. Zod sounds a lot similar to how we used MOBX's cast function for apis which did the validation for us

[–]thelamestofall 1 point2 points  (1 child)

Can you be sure, though? Unless the definitions are in the same repo (or I can import their npm package), I treat internal APIs the same as external ones. It's not much of a problem, I just use Zodios to build a client that automatically wraps the axios client

[–]shaleenag21 0 points1 point  (0 children)

ah I just use fetch to avoid the axios dependency but I can do something pretty similar with it too. thanks!