I would like to declare objects schemas (that can instantiate variables with default values, having validation rules, etc.) like it can be done in mongoose, but on the client-side.
Haven't found any library offering it. Is there something I missed?
visit https://github.com/spumko/joi and I think you'll find a lot of joy[i].
The joi validation system is used to validate JavaScript objects based on a rich descriptive schema. Schema validation is the process of ensuring that objects match pre-defined expectations.
I mainly use it with nodejs but I think you'll find it nice also to use on the client side with http://browserify.org/.
To solve this problem I created https://github.com/archangel-irk/storage
Mongoose-like schema validation, collections and documents on browser.
Forms-angular: http://www.forms-angular.org/
You can describe schema at the client side level (part of schemas or nested schemas/ arrays of subdocuments ...) and forms with validators are automatically generated.
Moreover, you can just define mongoose schemas at the backend level and you end up with a great front-end/backend system for creating/loading/editing/deleting items in a mongo db.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With