Hi
Looks possible to improve optional argument and reduce case with error.
I've found an old issue at SO : https://stackoverflow.com/questions/21241675/service-with-many-optional-parameters-with-restler
In validator.ph at https://github.com/Luracast/Restler/blob/master/src/Data/Validator.php#L512
I propose to add this patch :
if (!$info->required && isset($info->default) && empty($input)) {
$input = $info->default;
}
After default value is checked as any other input and must be compliant with other annotation/configuration set.
In this case annotation must be set with :
@param string $state {@required false} {@default defaultvalue}
If this idea is not too bad I can propose a related pull request
Hi
Looks possible to improve optional argument and reduce case with error.
I've found an old issue at SO : https://stackoverflow.com/questions/21241675/service-with-many-optional-parameters-with-restler
In validator.ph at https://github.com/Luracast/Restler/blob/master/src/Data/Validator.php#L512
I propose to add this patch :
After default value is checked as any other input and must be compliant with other annotation/configuration set.
In this case annotation must be set with :
If this idea is not too bad I can propose a related pull request