From db4355570795243888ab2b483c05342bb6e45536 Mon Sep 17 00:00:00 2001 From: Eleanor Lewis Date: Fri, 3 May 2024 09:47:02 -0700 Subject: [PATCH] update validateValue func --- src/services/schema.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/schema.tsx b/src/services/schema.tsx index 45d0f976..9cd987c5 100644 --- a/src/services/schema.tsx +++ b/src/services/schema.tsx @@ -141,26 +141,25 @@ const validateValue = (propModel, value, { ignoreMandatory = false }) => { }; if (Array.isArray(value) && value.length) { - // values could have different class models value.forEach((val) => { - embeddedModel = schemaDefn.get(val); + embeddedModel = schemaDefn.get(val['@class']); if (embeddedModel) { - Object.values(schemaDefn.getProperties(embeddedModel)).forEach((subPropModel) => { + Object.values(schemaDefn.getProperties(embeddedModel.name)).forEach((subPropModel) => { subErrors = valErrorCheck(subPropModel, val, subErrors); }); } }); } else { try { - embeddedModel = schemaDefn.get(value); + embeddedModel = schemaDefn.get(value['@class']); } catch (err) { } // eslint-disable-line no-empty if (!embeddedModel) { return { error: { '@class': { message: 'Required Value' } } }; } - Object.values(schemaDefn.getProperties(embeddedModel)).forEach((subPropModel) => { + Object.values(schemaDefn.getProperties(embeddedModel.name)).forEach((subPropModel) => { subErrors = valErrorCheck(subPropModel, value, subErrors); }); }