-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Right now, nested array and hash validations lead to a 'paren cascade' - which, while it may be suitable for a Lisp, looks quite uncomfortable in Ruby.
A more robust instance_eval-based builder may be sufficient to make construction of these validations more compact and more declarative.
This syntax would probably depend on #7.
Possible example of syntax:
hash {
before { rule(error: :invalid_key) { !_1.key? :bad_key } }
mandatory(:field_a) { typed(T::Decimal) > gteq(0) & lteq(100) }
optional(:field_b) { typed(T::String) }
after { rule(error: :mismatch) { _1[:field_b].nil? || _1[:field_a].to_s == _1[:field_b] } }
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request