set null when not required and data key is not set

This commit is contained in:
Damodar Lohani 2024-07-15 05:35:04 +00:00
parent b3aaca317c
commit 03c48a5ef3

View file

@ -590,7 +590,8 @@ class Response extends SwooleResponse
}
}
if(!$data->isSet($key) && !$rule['required']) { // skip attribute in response if not required and values does not exist
if(!$data->isSet($key) && !$rule['required']) { // set output key null if data key is not set and required is false
$output[$key] = null;
continue;
}