dry-rb / dry-rb/dry-validation

Support for pattern-matched rules

Open
#678 10 comments 5 reactions 1 assignee Claimed by @solnic View on GitHub
feature help wanted
Dominant language
Ruby
Stars
1.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

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

```ruby
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.