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
If you use Dry::Validation:Form with type_specs = true and arrays inside hashes (see example below), it won't coerce the values inside the array and fail instead.
Don't use the type_specs (duh) (probably not a good solution)
Define a type similar to IntArray = Dry::Types['form.array'].of(Dry::Types['coercible.int']) and use it in the validation block (required(:bar, IntArray).each(:int?))
This seems like a bug, so I'm opening this issue
UPD: wrote some tests to demonstrate both the problem and the 2nd solution workaround
The text was updated successfully, but these errors were encountered:
If you use
Dry::Validation:Form
withtype_specs = true
and arrays inside hashes (see example below), it won't coerce the values inside the array and fail instead.There are two workarounds I have found:
IntArray = Dry::Types['form.array'].of(Dry::Types['coercible.int'])
and use it in the validation block (required(:bar, IntArray).each(:int?)
)This seems like a bug, so I'm opening this issue
UPD: wrote some tests to demonstrate both the problem and the 2nd
solutionworkaroundThe text was updated successfully, but these errors were encountered: