perfect-payload 1.2.0-beta.0 → 1.2.0
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/README.md +1 -1
- package/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -578,7 +578,7 @@ function perfectPayloadStructured(
|
|
|
578
578
|
// ==================================================
|
|
579
579
|
|
|
580
580
|
case "mandatory":
|
|
581
|
-
if (isMandatoryField && !attrExist) {
|
|
581
|
+
if (isMandatoryField && (!attrExist || attributeValue === "")) {
|
|
582
582
|
addNextError = false;
|
|
583
583
|
|
|
584
584
|
addStructuredError(
|
|
@@ -599,7 +599,7 @@ function perfectPayloadStructured(
|
|
|
599
599
|
// ==================================================
|
|
600
600
|
|
|
601
601
|
case "allowNull":
|
|
602
|
-
if (addNextError && attributeValue
|
|
602
|
+
if (addNextError && attributeValue === null) {
|
|
603
603
|
if (!attributeRules?.[ruleName]) {
|
|
604
604
|
addNextError = false;
|
|
605
605
|
|
|
@@ -608,7 +608,7 @@ function perfectPayloadStructured(
|
|
|
608
608
|
attributePath,
|
|
609
609
|
"NULL_NOT_ALLOWED",
|
|
610
610
|
attributeRules?.["allowNullError"] ||
|
|
611
|
-
`value null
|
|
611
|
+
`value null not valid for attribute ${attributePath}`,
|
|
612
612
|
);
|
|
613
613
|
}
|
|
614
614
|
}
|