kubero icon indicating copy to clipboard operation
kubero copied to clipboard

use zod for better typings

Open techsavvyash opened this issue 2 years ago • 4 comments

Since the API is built using typescript, hence using zod to enforce better types especially for type checking he results of API calls might be a good idea.

techsavvyash avatar Oct 04 '23 13:10 techsavvyash

Still reading the docs. But still not 100% clear how and where to use it. I think it could improve the quality.

Found it by accident this project 😄 https://github.com/streetwriters/notesnook/blob/master/servers/themes/package.json#L18

mms-gianni avatar Oct 06 '23 12:10 mms-gianni

One of the reference areas of use could be to verify the results of API calls. For example as I am working on the onedev integration, I am required to perform a lot API calls to the onedev API, and even though I have defined custom types for the responses from the onedev API, there is no checking of those types, that's where I got the idea of integrating zod in the code base. You can have a look at the latest commit of #210 for reference.

techsavvyash avatar Oct 06 '23 14:10 techsavvyash

I finally think we should do this. Feel free to use it in your PR.

We will add this to the other API endpoints later.

mms-gianni avatar Oct 10 '23 06:10 mms-gianni

Thanks for the alignment, will start using it.

techsavvyash avatar Oct 10 '23 07:10 techsavvyash