From 5707f7d4d4c88ada9a8af10007ea6d448a067e1f Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 27 Oct 2023 15:18:58 -0400 Subject: [PATCH] remove properties with undefined values before validation: the SttTask superclass of gather and transcribe creates them for label and callbackVendor --- jambonz-app-json-validation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jambonz-app-json-validation.js b/jambonz-app-json-validation.js index b2c4fcb..88e39f6 100644 --- a/jambonz-app-json-validation.js +++ b/jambonz-app-json-validation.js @@ -58,7 +58,8 @@ function validateVerb(name, data, logger) { const dSpec = specData.properties[dKey]; debug(`Task:validate validating property ${dKey} with value ${JSON.stringify(dVal)}`); - if (typeof dSpec === 'string' && dSpec === 'array') { + if (typeof dVal === 'undefined') continue; + else if (typeof dSpec === 'string' && dSpec === 'array') { if (!Array.isArray(dVal)) throw new Error(`${name}: property ${dKey} is not an array`); } else if (typeof dSpec === 'string' && dSpec.includes('|')) {