Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client-side Mongoose-like schema definition [closed]

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?

like image 483
gwendall Avatar asked Oct 02 '13 10:10

gwendall


3 Answers

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/.

like image 139
Elad Amsalem Avatar answered Sep 21 '22 15:09

Elad Amsalem


To solve this problem I created https://github.com/archangel-irk/storage

Mongoose-like schema validation, collections and documents on browser.

like image 38
Konstantin Melnikov Avatar answered Sep 17 '22 15:09

Konstantin Melnikov


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.

like image 36
Derek Avatar answered Sep 17 '22 15:09

Derek