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

Switch from joi to zod #102

Open
luixo opened this issue Oct 14, 2022 · 5 comments
Open

Switch from joi to zod #102

luixo opened this issue Oct 14, 2022 · 5 comments
Assignees

Comments

@luixo
Copy link
Contributor

luixo commented Oct 14, 2022

While working types unification I stumbled upon Joi library downsides types-wise.
I think we should consider moving to another library which would give us more strict types on endpoint inputs (and maybe outputs).

So what's missing?

  • type inference - I have to put types manually to Joi.object
  • literal union doesn't work - the type is any
  • array doesn't work - types of the items are lost
  • discriminated union are broken in a way that they don't produce any - one would usually use Joi.alternatives to run the validation though the types expect Joi.SchemaMap.

I would suggest us moving to zod, I used it in explorer and a few pet projects and value it a lot. I open to other suggestions as well.

@mpeterdev
Copy link
Collaborator

already have a ticket for this 😄
#78

@luixo
Copy link
Contributor Author

luixo commented Oct 14, 2022

Should we keep the discussion here as I pointed out specific details or in the #78 because it has precedence? :)

@mpeterdev mpeterdev changed the title Evaluate Joi vs. other validation libraries Switch from joi to zod Oct 14, 2022
@mpeterdev
Copy link
Collaborator

condensing here since you provided more details 👍

@luixo
Copy link
Contributor Author

luixo commented Oct 14, 2022

As for a new name of the issue - do we agree on zod, can we implement that yet?

@mpeterdev
Copy link
Collaborator

yep, if you have had good experiences with it then let's go for it

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

No branches or pull requests

5 participants