Mobitel Ltd. zSchema readable error
NodeJs module for transforn errors of zSchema module to user friendly and readable string
Attention
This module writing and testing on NodeJs v.8+ and NPM v.5+. Using the module in previous versions of NodeJs does not guarantee correct works.
Navigation
Installation
npm i --save mobitel-zschema-readable-error
Usage
const ZSchema = ;const zSchemaError = ;const schema = ;const json = ; // this initialization ZSchema only for exampleconst zSchema = noEmptyArrays: true noEmptyStrings: true noTypeless: true; // asynczSchema; // syncif !zSchema let errors = zSchema; const readableErrors = console; // => Object didn't pass validation for format hostname: http://some.site in schema 'test' in property 'propStringFormat'; Expected type array but found type boolean in schema 'test' in property 'propArray' return false;
If module can not parsing z-schema error, then return string like:
Can not parsing z-schema error because get: false
Test
npm run test
License
MIT License.
Copyright (c) 2017 Mobitel Ltd
up to navigation