nox-validation 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/validate.js +8 -6
- package/package.json +1 -1
package/lib/validate.js
CHANGED
|
@@ -496,7 +496,7 @@ const validateMetaRules = (
|
|
|
496
496
|
label: node.display_label,
|
|
497
497
|
}),
|
|
498
498
|
actionFn: (node) => {
|
|
499
|
-
const normalize = (path) => path.replace(/\[\d+\]/g, "
|
|
499
|
+
const normalize = (path) => path.replace(/\[\d+\]/g, "");
|
|
500
500
|
|
|
501
501
|
const getRoot = (path) => normalize(path).split(".")[0];
|
|
502
502
|
|
|
@@ -537,9 +537,11 @@ const validateMetaRules = (
|
|
|
537
537
|
!normalize(fPath).startsWith(normalize(currentPath)) &&
|
|
538
538
|
getRoot(fPath) !== getRoot(currentPath)
|
|
539
539
|
) {
|
|
540
|
-
if (currentPath.includes(fPath)) {
|
|
541
|
-
fPath = currentPath
|
|
542
|
-
}
|
|
540
|
+
if (!currentPath.includes(fPath)) {
|
|
541
|
+
fPath = `${currentPath}.${fPath}`;
|
|
542
|
+
}
|
|
543
|
+
} else if (fPath !== currentPath) {
|
|
544
|
+
fPath = currentPath;
|
|
543
545
|
}
|
|
544
546
|
|
|
545
547
|
// if (
|
|
@@ -570,7 +572,7 @@ const validateMetaRules = (
|
|
|
570
572
|
language_codes.forEach((lang, index) => {
|
|
571
573
|
let langPath, transformedPath;
|
|
572
574
|
let isAdded = false;
|
|
573
|
-
//
|
|
575
|
+
// Check if current language entry exists in fieldValue.create
|
|
574
576
|
if (
|
|
575
577
|
Array.isArray(fieldValue?.create) &&
|
|
576
578
|
fieldValue?.create.some((item, idx) => {
|
|
@@ -1533,7 +1535,7 @@ const validate = (data) => {
|
|
|
1533
1535
|
}
|
|
1534
1536
|
}
|
|
1535
1537
|
|
|
1536
|
-
result.errors[fieldPath] = obj;
|
|
1538
|
+
result.errors[fieldPath] = { ...obj, fieldId: field?.field_id };
|
|
1537
1539
|
result.status = false;
|
|
1538
1540
|
}
|
|
1539
1541
|
if (abortEarly && !result.status) return result;
|