nox-validation 1.1.0 → 1.1.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.
- package/lib/helpers.js +1 -1
- package/lib/validate.js +7 -4
- package/package.json +1 -1
package/lib/helpers.js
CHANGED
|
@@ -547,7 +547,7 @@ const getForeignCollectionDetails = ({
|
|
|
547
547
|
this_collection: mainTable.one_collection_id,
|
|
548
548
|
this_field: "_id",
|
|
549
549
|
foreign_collection:
|
|
550
|
-
iFace === constants.interfaces.MANY_TO_MANY
|
|
550
|
+
iFace === constants.interfaces.MANY_TO_MANY
|
|
551
551
|
? relational?.one_collection_id
|
|
552
552
|
: iFace === constants.interfaces.MANY_TO_ANY
|
|
553
553
|
? relational?.one_allowed_collections_id
|
package/lib/validate.js
CHANGED
|
@@ -681,9 +681,12 @@ const validate = (data) => {
|
|
|
681
681
|
language,
|
|
682
682
|
maxLevel,
|
|
683
683
|
} = data;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
684
|
+
|
|
685
|
+
if (!data?.language) {
|
|
686
|
+
data.language = constants.LANGUAGES.en;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const error_messages = constants.LOCALE_MESSAGES[language];
|
|
687
690
|
|
|
688
691
|
let result = { status: true, errors: {}, data: formData };
|
|
689
692
|
|
|
@@ -851,7 +854,7 @@ const validate = (data) => {
|
|
|
851
854
|
isRoot: true,
|
|
852
855
|
}) || [];
|
|
853
856
|
|
|
854
|
-
findDisallowedKeys(formData, fieldOptions,maxLevel).forEach((fieldPath) => {
|
|
857
|
+
findDisallowedKeys(formData, fieldOptions, maxLevel).forEach((fieldPath) => {
|
|
855
858
|
if (abortEarly && !result.status) return result;
|
|
856
859
|
const fieldKey = getLastChildKey(fieldPath);
|
|
857
860
|
if (fieldKey && !result.errors[fieldPath]) {
|