wadofgum-json-schema
Advanced tools
Comparing version 0.3.1 to 0.4.0
## Changelog | ||
+ 0.3.1 - improved returned error object form z-schema | ||
+ 0.4.0 - minor bump for removing deps, updating wadofgum version and for validating schema being set on static method | ||
+ 0.3.1 - improved returned error object form z-schema | ||
+ 0.3.0 - updated dependencies and added validator static property to pass reference of z-schema to class instance |
'use strict'; | ||
const Validate = require('./validate.js'); | ||
@@ -10,3 +9,2 @@ module.exports = function (baseClass) { | ||
Validate.assert('Schema', rawSchema); | ||
this.meta.set('metaSchema', rawSchema.metaSchema); | ||
@@ -13,0 +11,0 @@ this.meta.set('schema', rawSchema.schema); |
{ | ||
"name": "wadofgum-json-schema", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "json schema validation for wadofgum models", | ||
@@ -29,7 +29,3 @@ "main": "lib/index.js", | ||
"z-schema": "^3.16.0" | ||
}, | ||
"dependencies": { | ||
"hoek": "^3.0.1", | ||
"joi": "^7.0.0" | ||
} | ||
} |
'use strict'; | ||
const Code = require('code'); | ||
const Hoek = require('hoek'); | ||
// const Hoek = require('hoek'); | ||
const Lab = require('lab'); | ||
@@ -31,14 +31,14 @@ const Wadofgum = require('wadofgum'); | ||
it('should throw if invalid rawSchema used is invalid', (done) => { | ||
// it('should throw if invalid rawSchema used is invalid', (done) => { | ||
// | ||
// class Person extends Wadofgum.mixin(Validation) {}; | ||
// const InvalidSchema = Hoek.clone(PersonSchema); | ||
// delete InvalidSchema.metaSchema; | ||
// expect(() => { | ||
// | ||
// Person.schema = InvalidSchema; | ||
// }).to.throw(Error); | ||
// done(); | ||
// }); | ||
class Person extends Wadofgum.mixin(Validation) {}; | ||
const InvalidSchema = Hoek.clone(PersonSchema); | ||
delete InvalidSchema.metaSchema; | ||
expect(() => { | ||
Person.schema = InvalidSchema; | ||
}).to.throw(Error); | ||
done(); | ||
}); | ||
it('errors when attempting to validate a model with no schema', (done) => { | ||
@@ -45,0 +45,0 @@ |
0
19657
9
441
- Removedhoek@^3.0.1
- Removedjoi@^7.0.0
- Removedhoek@3.0.44.3.1(transitive)
- Removedisemail@2.2.1(transitive)
- Removedjoi@7.3.0(transitive)
- Removedmoment@2.30.1(transitive)
- Removedtopo@2.1.1(transitive)