These are chat archives for dry-rb/chat
Next-gen ruby libs! » github.com/dry-rb » website: https://dry-rb.org » forum: https://discourse.dry-rb.org
Thanks for answer but is any possibility to do something like that :
optional(:employee_attributes).maybe(:array?).each do key(:attribute_name).required(:str?) key(:value).required optional(:order).maybe(:int?) end
When I have in params employee_attributes I want to check its attributes, and when I have "" or nil or  - return true. I tried to write my custom rule but it doesn’t work for array.
optional(:employee_attributes).maybe(:array?) rule(present_employee_attributes: [:employee_attributes]) do |attributes| attributes.is_present? end configure do def is_present?(attributes) return true if attributes.empty? attributes end end
What I'm doing wrong?
eachis not supported yet, I'll be adding this for 0.8.0 release
each, nested key syntax will be gone in 0.8.0