Skip to content
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

Feat: add zod for object validation #227

Open
cre8 opened this issue May 7, 2024 · 2 comments
Open

Feat: add zod for object validation #227

cre8 opened this issue May 7, 2024 · 2 comments

Comments

@cre8
Copy link
Contributor

cre8 commented May 7, 2024

Using zod could help to validate objects before dealing with them. This should be implemented for all packages where required

@lukasjhan
Copy link
Member

Can you tell me what examples there are?

@cre8
Copy link
Contributor Author

cre8 commented May 29, 2024

It would help to validate variables. So instead of

if(jwk.exp && typeof jwk.exp === number) {

}

you could go with

const schema = z.number();
schema.parse(jwk.exp)

While I think ZOD is nice, I do not see so many values that we need to type check for validation (Timo brought the topic up in one of the issues)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants