You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAML validators with 0 attributes cause the error UserFrosting\Fortress\Adapter\JqueryValidationAdapter::transformValidator(): Argument #3 ($validator) must be of type array, null given when the page is loaded.
Docs do not (yet) address this edge case. Is it more correct to allow validators with no attributes, or to require that all validators have at least one attribute? 'label' or 'message' attributes seem applicable for most use cases.
In 5.1, $transformed = match ($validatorName) { block does not pass $validator to every option, so there may be room to allow it to be null.
Then perhaps escape it with $validator = $validator ?? array() at beginning of method?
[whatever the correct syntax would be for that ?? operator]
The text was updated successfully, but these errors were encountered:
Then perhaps escape it with $validator = $validator ?? array() at beginning of method?
I like that idea. To avoid this issue in other, all Fortress methods currently tested agains't json schema should also be tested agains't YAML schemas.
Chat discussion at https://chat.userfrosting.com/channel/support?msg=4x7WkcL72ehSs9WXq
YAML validators with 0 attributes cause the error
UserFrosting\Fortress\Adapter\JqueryValidationAdapter::transformValidator(): Argument #3 ($validator) must be of type array, null given
when the page is loaded.JqueryValidationArrayAdapter line 70 calls transformValidator(), line 107 in the same class.
example YAML:
is equivalent to JSON
Spotted in UF5.0, still exists in 5.1
Docs do not (yet) address this edge case. Is it more correct to allow validators with no attributes, or to require that all validators have at least one attribute? 'label' or 'message' attributes seem applicable for most use cases.
In 5.1,
$transformed = match ($validatorName) {
block does not pass$validator
to every option, so there may be room to allow it to be null.Then perhaps escape it with
$validator = $validator ?? array()
at beginning of method?[whatever the correct syntax would be for that ?? operator]
The text was updated successfully, but these errors were encountered: