Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agonbina/store-validate
[Deprecated] A plugin to be used with @bredele/datastore to validate your models using a JSON Schema
https://github.com/agonbina/store-validate
Last synced: about 1 month ago
JSON representation
[Deprecated] A plugin to be used with @bredele/datastore to validate your models using a JSON Schema
- Host: GitHub
- URL: https://github.com/agonbina/store-validate
- Owner: agonbina
- License: mit
- Created: 2014-08-30T14:01:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-21T02:56:42.000Z (about 10 years ago)
- Last Synced: 2024-04-14T20:06:25.957Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 211 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
You should not use this as its no longer supported
===[ ![Codeship Status for agonbina/store-validate](https://www.codeship.io/projects/088558b0-14db-0132-8085-3ea9ac9fe796/status)](https://www.codeship.io/projects/33539)
store-validate
====
A [datastore](https://github.com/bredele/datastore/) plugin to validate your data using a JSON Schema.
Also works with [sleek](https://github.com/bredele/sleek/)Internally it uses [swagger-validate](https://github.com/signalfuse/swagger-validate) which works in the browser and nodeland
Example:
====
```
var Store = require('datastore');
var validate = require('..');var user = new Store({
username: 'agonbina',
age: 25
});
var userSchema = {
properties: {
username: { type: 'string' },
age: { type: 'number' }
},
required: [ 'username', 'age' ]
};user.use(validate, userSchema);
var result = user.validate(); // No errors, 'result' is undefined
```
Run tests with **npm test**