Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert validation from joi to yup (adamgibbons#178)
Rationale @hapi/joi is huge and a significant download burden in the browser, see adamgibbons#149 Yup was designed to be a lightweight, browser friendly, alternative to @hapi/joi, its interface is pretty similar, this did make the transition substantially easier. I'll admit I have a bias, I use yup all over the place already so I didn't look at alternatives. There are at least two issues associated with this PR. 1. I picked yum, this suits me, is much smaller than joi and is functionally sufficient for the project. But it's likely that this choice won't satisfy everyone. 2. This substantially changes the error reporting from validateEvent, that ripples up through the api and is in turn exposed as the error object from createEvents. You can see that nearly all of the test changes are because of this - not all though, there were a couple of others that might want a look at. I also wonder if the right long term approach might be to make the validation system a bit more pluggable. Rather than picking one back end validation system, support a few, rely upon peer dependencies and require some sort of config to tell the library what validation to use. Certainly more than I wanted to do off the bat, but perhaps a way forward without whatever preferred library choice being wrong for someone. As for testing, all of the tests pass, thank you for making it so easy to work on the project. I've also tested this in my personal app and it is working there perfectly. Co-authored-by: Adam Gibbons <[email protected]>
- Loading branch information