nox-validation 1.5.0 → 1.5.1

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/helpers.js CHANGED
@@ -1376,7 +1376,9 @@ const getSelectedNodes = ({
1376
1376
  ...child,
1377
1377
  key:
1378
1378
  currentNode.type === constants.types.ARRAY
1379
- ? child.key.replace(currentNode.key, `${currentNode.key}[0]`)
1379
+ ? child.key.includes(`${currentNode.key}[`)
1380
+ ? child.key
1381
+ : child.key.replace(currentNode.key, `${currentNode.key}[0]`)
1380
1382
  : child.key,
1381
1383
  };
1382
1384
 
@@ -1393,13 +1395,6 @@ const getSelectedNodes = ({
1393
1395
  }
1394
1396
  return updatedNode;
1395
1397
  };
1396
- if (currentNode.type === constants.types.ARRAY) {
1397
- childNode = updateChildKeys(
1398
- child,
1399
- currentNode.key,
1400
- `${currentNode.key}[0]`
1401
- );
1402
- }
1403
1398
  }
1404
1399
 
1405
1400
  if (!skipFn(currentNode)) traverse(childNode);
package/lib/validate.js CHANGED
@@ -256,7 +256,7 @@ const validateMetaRules = (
256
256
 
257
257
  let {
258
258
  required = false,
259
- nullable = false,
259
+ nullable = true,
260
260
  options,
261
261
  is_m2a_item,
262
262
  } = field?.meta ?? {};
@@ -406,10 +406,10 @@ const validateMetaRules = (
406
406
  }),
407
407
  actionFn: (node) => {
408
408
  let fPath = node.key;
409
- if (fPath.includes("update.")) return;
410
- if (fPath.includes("create.") && !isTranslationChild) return;
411
- if (fPath.includes("delete.") && !isTranslationChild) return;
412
- if (fPath.includes("existing.") && !isTranslationChild) return;
409
+ if (fPath.includes("update")) return;
410
+ if (fPath.includes("create") && !isTranslationChild) return;
411
+ if (fPath.includes("delete") && !isTranslationChild) return;
412
+ if (fPath.includes("existing") && !isTranslationChild) return;
413
413
 
414
414
  const label = formatLabel(node.display_label);
415
415
  const message = error_messages.REQUIRED.replace("{field}", label);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nox-validation",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "validate dynamic schema",
5
5
  "main": "index.js",
6
6
  "scripts": {