Schema: removed filter function for getValidated to return empty object in case of error;

Added OVV_KEYS_BADFORMAT message to throw in case of error;
This commit is contained in:
Alexander Cerutti
2019-01-22 00:35:23 +01:00
parent dcd73c0cb4
commit 02a932ce7a
3 changed files with 12 additions and 28 deletions

View File

@@ -370,7 +370,7 @@ class Pass {
let valid = data
.map(o => schema.getValidated(o, "barcode"))
.filter(o => o instanceof Object);
.filter(o => !!Object.keys(o).length);
if (valid.length) {
this._props["barcode"] = valid[0];
@@ -669,8 +669,11 @@ class Pass {
}
let modelPath = path.resolve(options.model) + (!!options.model && !path.extname(options.model) ? ".pass" : "");
const filteredOpts = schema.getValidated(options.overrides, "supportedOptions");
const filteredOpts = schema.filter(options.overrides, "supportedOptions");
if (!Object.keys(filteredOpts).length) {
throw new Error(formatMessage("OVV_KEYS_BADFORMAT"))
}
return {
model: modelPath,