nox-validation 1.2.2 → 1.2.3

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
@@ -800,6 +800,7 @@ const buildNestedStructure = ({
800
800
  required: item.meta?.required || false,
801
801
  nullable: item.meta?.nullable || false,
802
802
  hidden: item.meta?.hidden || false,
803
+ options: item.meta?.options || {},
803
804
  },
804
805
  validations: generateModifiedRules(item?.meta, item?.meta?.validations?.validation_msg),
805
806
  custom_error_message: item?.meta?.validations?.validation_msg,
@@ -988,7 +989,7 @@ const generateFieldCompareRules = (rule) => {
988
989
 
989
990
  const generateModifiedRules = (meta, custom_message) => {
990
991
  let rules = [];
991
- if(meta?.validations?.rules?.length > 0){
992
+ if (meta?.validations?.rules?.length > 0) {
992
993
  rules = meta?.validations?.rules?.map((rule, index) => {
993
994
  let modifiedRule = {
994
995
  identifier: String(index),
@@ -1109,7 +1110,7 @@ const generateModifiedRules = (meta, custom_message) => {
1109
1110
  break;
1110
1111
  }
1111
1112
  }
1112
-
1113
+
1113
1114
  return modifiedRule;
1114
1115
  });
1115
1116
  }
@@ -1123,7 +1124,7 @@ const generateModifiedRules = (meta, custom_message) => {
1123
1124
  options: {},
1124
1125
  custom_message,
1125
1126
  };
1126
- rules.push(modifiedRule)
1127
+ rules.push(modifiedRule);
1127
1128
  }
1128
1129
  return rules;
1129
1130
  };
package/lib/validate.js CHANGED
@@ -186,7 +186,7 @@ const validateMetaRules = (
186
186
 
187
187
  if (
188
188
  choices.includes(field?.meta?.interface) &&
189
- (!options?.choices || options?.choices?.length > 0)
189
+ (!options?.choices || !options?.choices?.length > 0)
190
190
  ) {
191
191
  const message = error_messages.ADD_CHOICE.replace(`{field}`, formatLabel(field.display_label));
192
192
  addError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nox-validation",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "validate dynamic schema",
5
5
  "main": "index.js",
6
6
  "scripts": {