dry-rb/dry-validation

Support for pattern-matched rules

Open

#678 建立於 2020年12月16日

在 GitHub 查看
 (10 留言) (5 反應) (1 負責人)Ruby (193 fork)github user discovery
featurehelp wanted

倉庫指標

Star
 (1,421 star)
PR 合併指標
 (PR 指標待抓取)

描述

In order to make defining rules that depend on additional conditions nicer, we can have something like this:

params do
  optional(:per_page).value(:integer)
end

rule(:per_page).if(:key?).validate(gt?: 0, lteq?: 20)

See the original conversation: https://github.com/dry-rb/dry-validation/issues/540#issuecomment-744022950

貢獻者指南