remove properties with undefined values before validation: the SttTask superclass of gather and transcribe creates them for label and callbackVendor

This commit is contained in:
Dave Horton
2023-10-27 15:18:58 -04:00
parent f75871dc46
commit 5707f7d4d4

View File

@@ -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('|')) {