nox-validation 1.5.1 → 1.5.2

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.
Files changed (2) hide show
  1. package/lib/validate.js +5 -2
  2. package/package.json +1 -1
package/lib/validate.js CHANGED
@@ -1144,7 +1144,10 @@ const validate = (data) => {
1144
1144
  };
1145
1145
 
1146
1146
  const addError = (fieldPath, obj, field) => {
1147
- if (byPassKeys.some((key) => fieldPath.includes(key))) return;
1147
+ const fieldKey = getLastChildKey(fieldPath);
1148
+ const isBypass = byPassKeys?.some((key) => key === fieldKey);
1149
+
1150
+ if (isBypass) return;
1148
1151
  if (!result.errors[fieldPath] && !field?.meta?.hidden) {
1149
1152
  const pathResult = extractRelationalParents(fieldPath);
1150
1153
  if (pathResult) {
@@ -1350,7 +1353,7 @@ const validate = (data) => {
1350
1353
  findDisallowedKeys(formData, fieldOptions, maxLevel).forEach((fieldPath) => {
1351
1354
  if (abortEarly && !result.status) return result;
1352
1355
  const fieldKey = getLastChildKey(fieldPath);
1353
- const isBypass = byPassKeys?.some((key) => fieldPath?.includes(key));
1356
+ const isBypass = byPassKeys?.some((key) => key === fieldKey);
1354
1357
  if (fieldKey && !result.errors[fieldPath] && !isBypass) {
1355
1358
  addError(fieldPath, {
1356
1359
  label: formatLabel(fieldKey),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nox-validation",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "validate dynamic schema",
5
5
  "main": "index.js",
6
6
  "scripts": {