dry-rb / dry-rb/dry-validation

Add key.success? and key.failure? predicates

Open
#615 12 comments 0 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
Ruby
Stars
1.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

In complex rules, it may be useful to know whether the key has any failure message already.

```ruby
rule(:foos).each do
key.success? # => true
key.failure? # => false
key.failure('wrong')
key.success? # => false
key.failure? # => true
end
```

Contributor guide

Open the contributing guide

Research direction

Begin by tracing the key object exposed inside rule(:foos).each and how failure messages are recorded. Completion should cover the example's state transitions: success? is true before a failure, then false, while failure? changes from false to true after key.failure('wrong'). Add focused tests for these transitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.