JSON Schema Proxy for validation any object on read and write
Ivan Asmer db15f42980 readme fixes | 3 gadi atpakaļ | |
---|---|---|
.gitignore | 3 gadi atpakaļ | |
README.md | 3 gadi atpakaļ | |
index.js | 3 gadi atpakaļ | |
package-lock.json | 3 gadi atpakaļ | |
package.json | 3 gadi atpakaļ |
const jsonSchemaProxy = require('json-schema-proxy')
const proxiedObject = jsonSchemaProxy(objectToProxy, inputJsonSchema, outputJsonSchema)
proxiedObject.foo = 'some value'
will cause exception in case of failed inSchema validation. Object remains untouched
let variable = proxiedObject.foo
will give undefined in case of failed outSchema validation.
outSchema
can be omitted if you don't need output validation.
outSchema
filters wrong fields or additionalProperties
not listed in outSchema