Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add key? method to rule blocks #550

Merged
merged 7 commits into from
Jun 14, 2019
Merged

Conversation

solnic
Copy link
Member

@solnic solnic commented Jun 14, 2019

This is helpful when dealing with optional keys. We can't just assume
that we do not want to execute a rule when a value was missing.

Good example: a password must be provided when login is provided, and
both are optional.

Refs #540

spec/unit/values_spec.rb Show resolved Hide resolved
spec/unit/values_spec.rb Show resolved Hide resolved
lib/dry/validation/values.rb Outdated Show resolved Hide resolved
spec/unit/values_spec.rb Show resolved Hide resolved
spec/unit/values_spec.rb Show resolved Hide resolved
spec/integration/contract/call_spec.rb Show resolved Hide resolved
spec/integration/contract/call_spec.rb Outdated Show resolved Hide resolved
spec/integration/contract/call_spec.rb Outdated Show resolved Hide resolved
spec/integration/contract/call_spec.rb Show resolved Hide resolved
@solnic solnic requested a review from flash-gordon June 14, 2019 09:43
Piotr Solnica added 4 commits June 14, 2019 12:03
This is helpful when dealing with optional keys. We can't just assume
that we do not want to execute a rule when a value was missing.

Good example: a password must be provided when login is provided, and
both are optional.

Refs #540
@solnic solnic force-pushed the 540-fix-handling-of-optional-keys branch from 6f8ab38 to fad5f40 Compare June 14, 2019 10:03
@solnic solnic requested a review from flash-gordon June 14, 2019 10:21
@solnic solnic changed the title Add Values#key? and Evaluator#value? Add key? method to rule blocks Jun 14, 2019
@solnic solnic merged commit da14934 into master Jun 14, 2019
@solnic solnic deleted the 540-fix-handling-of-optional-keys branch June 14, 2019 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants