@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 item validation
97
+ } // Array validation — schema (objects) or enum (primitives), not both
98
98
 
99
99
 
100
- if (rules.type === 'array' && rules.schema && Array.isArray(value)) {
101
- value.forEach((item, index) => {
102
- validate({
103
- schema: rules.schema,
104
- data: item,
105
- path: `${fieldPath}[${index}]`,
106
- entityName
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-leftPanelPoc3",
3
+ "version": "1.0.0-leftPanelPoc4",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",