add unknownutil validator
Hi!
I created a middleware of unknownutil (https://github.com/lambdalisue/deno-unknownutil)
This is kind of a zod or valibot, but so much faster and lighter!
⚠️ No Changeset found
Latest commit: fd8b4921b4aa47de0e1713408d567a9a78d8106c
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hi @ryoppippi !
Thanks for the PR. I didn't know unknownutil!
I'm curious about one thing. It seems to me that unknownutil only validates Types. So, in practice, it can only be used for "JSON". zod and valibot will validate the actual value. Examples, length of string, whether it is an email or not.
z.string().length(5);
z.string().email();
But unknownutil only handles Types. Honesty, I'm not a fan of calling it a Validator, what do you think?
Hi @yusukebe Thank you for checking and reviewing my PR!!
As you mentioned, unknownutil validates only types. It is not a "data validator" but "type validator".
The bundle size is so tiny and it works really fast.
I'm a huge fan of Hono RPC.
Recently I've been using unknownutil with Hono for typing.
Although unknownutil lacks some features like length or email, It is quite useful for simple API.
For this purpose, I only need to type the input and check the type and keys. So data validation like zod or validot is too much for that purpose.
If you do not think this is a validator, I'll close this and create an independent repository.
PS: lizod is a similar type of validation library. This also only validates type
Here is the author of unknownutil commenting about whether it is a validator or not
https://github.com/icebob/validator-benchmark/pull/7#issuecomment-1751182584
Hi @ryoppippi,
Thanks for the explanation!
I understand well that unknownutil is not a data validator but a type validator. I also understand that you prefer to use unknownutil.
However, I would like to reject this PR, because most people imagine an actual data validator when they hear the word "Validator".
If you do not think this is a validator, I'll close this and create an independent repository.
When you create your repository, you can add the project to this page!
https://hono.dev/middleware/third-party
@yusukebe So you can close this issue Cheers
@ryoppippi
Okay! Cheers.