Closed TomashKhamlai closed 5 years ago
I checked this issue but:
The postcode
in the table eav_attribute
the column is_required
is set to 0
.
The implementation on the file: \Magento\CustomerGraphQl\Model\Customer\Address\CreateCustomerAddress::validateData
foreach ($attributes as $attributeName => $attributeInfo) {
if ($attributeInfo->getIsRequired()
&& (!isset($addressData[$attributeName]) || empty($addressData[$attributeName]))
) {
$errorInput[] = $attributeName;
}
}
if the postcode
field is not required, so I think the behaviour is ok.
We have 2 options:
1) Add is_required
in table eav_attribute
. This can be a problem... for BC and the other implementations.
2) Add to validate data something like:
foreach ($attributes as $attributeName => $attributeInfo) {
if (($attrtibuteName == 'postcode' && && (!isset($addressData[$attributeName]) || empty($addressData[$attributeName])) || $attributeInfo->getIsRequired()
&& (!isset($addressData[$attributeName]) || empty($addressData[$attributeName]))
) {
$errorInput[] = $attributeName;
}
}
I saw the validation after save. Creating a PR
Hi @TomashKhamlai. Thank you for your report. The issue has been fixed in magento/graphql-ce#1031 by @osrecio in 2.3-develop branch Related commit(s):
The fix will be available with the upcoming 2.3.5 release.
Preconditions (*)
No preconditions
Steps to reproduce (*)
Expected result (*)
Actual result (*)