imbrn/v8n

This is not another input field validation library

StarpTech opened this issue · 6 comments

This is not another input field validation library.

What's the difference between joi and v8n?

Joi

  • Fluent and chainable API;
  • Useful standard validation rules;
  • Custom validations rules;
  • Reusability;

I'm really interested in how v8n differs from other libraries like joi. Does it focus on browser, server or both?

Joi is a really great project for object validation, but it’s not a general fluid validation library. It’s more for creating Schemas for objects, which is not really what v8n does as a general purpose library.

Thanks for the fast response but I'm not convinced. It would cost few lines of code to use joi as general purpose library. What's the big deal behind v8n? Don't get me wrong it looks nice but it feels like a yet another thing.

But joy is not targeted at that, there are plenty of libraries that are similar yet aren't the same. Joi very decidedly doesn't market itself as a validation tool and instead chooses to call itself a "schema" and "blueprint" tool for objects.

I see your point, the API looks similar and I agree that Joi could probably be turned into general validation with reasonable effort. I also think that nuances are key in many JavaScript libraries and that's why both v8n and Joi are perfectly fine where they are positioned.

This is the beauty of open-source and the npm community. If you like Joi you are free to implement a general purpose validation for it and use that. v8n aims to generalize fluid validation to any use-case out of the box. It's anyone's choice.

imbrn commented

Thank you @StarpTech for your question.

Answering your last one. This library is focused on both browser and server. Actually, it's intended to use validation strategies shared between them.

Now, about the difference between v8n and Joi, here's my opinion:

Although I haven't used the Joi library too much, I think it's great and very powerful. But personally, I prefer v8n because of its simplicity and clarity for declaring validations.

Also, the way Joi make validations is a lot different from v8n's. We are focused on any kind of validation, whereas Joi is more focused on object schema validation, as @sebastianbarfurth has already said.

So, I don't think we have to pick a library and make it the very best choice for all use cases just because we like it. As good engineers, we always have to analyze each situation so we can better decide what we should use in our project.

Finally, I don't think this is the best place for us to discuss about this kind of question. There's a lot of more appropiate places for this purpose.

Thanks! This is what I expected. While I understand your facts at the end we have to make reasonable decisions and in the current state it looks like that v8n is more or less the same as joi. I just wanted to understand the statement on the Readme.

imbrn commented

I think it's very different from Joi. They both look nice, clean, fluent, whatever... but in the end, they do different works. Actually, I hope someday someone can use them both together. 😍