Closed willwhite closed 8 years ago
@willwhite it looks like @Vertice may have tracked down a "better JSV" - https://github.com/Baggz/Amanda
He's going to be evaluating it the next day or so, but it looks promising.
I wrote some tests in mocha to evaluate it, but I had to solve some pretty minor issues in amanda itself to get it to work.
I used the project schema and fixtures from tilemill to do the tests against, but I am not sure of it's completeness. The is no guarantee that when we write a constraint in our schemas they actually end up performing any or even the correct validation.
It's browser support also doesnt seem complete.
One important wrinkle in the JSV implementation found in tilemill and other bones sites, is that unless you set an id on the model.schema, you will be unable to re-use a previously instantiated validation object and it will re-run the createSchema every time the validate function is called, which is could also be every time .set() is called.
Adding the 'id: "project"' line to the project schema should cause significant speed increases.
While i am going through bones to find a general issue to the above problem, i looked into trimming down JSV a bit. You do not need the other environments to be sent to the client if you aren't validating against them, and the file sizes were as follows:
Closing.
@yhahn's commit above (adding ID's to each schema) seems unrelated to this issue, and we are still using JSV, so re-opening.
We need a lightweight JSON schema parser that can run in the browser and allow us to provide custom error messages.