Skip to content

Commit

Permalink
remove properties with undefined values before validation: the SttTas…
Browse files Browse the repository at this point in the history
…k superclass of gather and transcribe creates them for label and callbackVendor
  • Loading branch information
davehorton committed Oct 27, 2023
1 parent f75871d commit 5707f7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jambonz-app-json-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('|')) {
Expand Down

0 comments on commit 5707f7d

Please sign in to comment.