@zohoim/client-sdk 1.0.0-leftPanelPoc3 → 1.0.0-leftPanelPoc4
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.
|
@@ -94,18 +94,31 @@ export const validateSchema = _ref4 => {
|
|
|
94
94
|
path: fieldPath,
|
|
95
95
|
entityName
|
|
96
96
|
});
|
|
97
|
-
} // Array
|
|
97
|
+
} // Array validation — schema (objects) or enum (primitives), not both
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
if (rules.type === 'array' &&
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
if (rules.type === 'array' && Array.isArray(value)) {
|
|
101
|
+
if (rules.schema && rules.enum) {
|
|
102
|
+
console.warn(`${entityName} - ${fieldPath} must define either schema or enum for array, not both`);
|
|
103
|
+
} else if (rules.schema) {
|
|
104
|
+
value.forEach((item, index) => {
|
|
105
|
+
validate({
|
|
106
|
+
schema: rules.schema,
|
|
107
|
+
data: item,
|
|
108
|
+
path: `${fieldPath}[${index}]`,
|
|
109
|
+
entityName
|
|
110
|
+
});
|
|
107
111
|
});
|
|
108
|
-
})
|
|
112
|
+
} else if (rules.enum) {
|
|
113
|
+
value.forEach((item, index) => {
|
|
114
|
+
validateEnumCheck({
|
|
115
|
+
value: item,
|
|
116
|
+
rules,
|
|
117
|
+
path: `${fieldPath}[${index}]`,
|
|
118
|
+
entityName
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
124
|
});
|