dry-rb / dry-rb/dry-validation
Support for "validate" helper within rule blocks
Open
feature
help wanted
- Dominant language
- Ruby
- Stars
- 1.4k
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
Support for executing predicates using `validate` method within `rule` blocks will make it much easier to apply various checks with extra conditions:
```ruby
params do
optional(:per_page).filled(:integer)
end
rule(:per_page) do
if key?
key.failure("must be within 0..20 range") unless validate(gt?: 0, lteq?: 20)
end
end
```
See the original conversation: https://github.com/dry-rb/dry-validation/issues/678
Contributor guide
Assessment
This issue has not been assessed yet.