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

Skipped property is still passed for validation #512

Open
AndKiel opened this issue Jun 3, 2020 · 0 comments
Open

Skipped property is still passed for validation #512

AndKiel opened this issue Jun 3, 2020 · 0 comments

Comments

@AndKiel
Copy link

AndKiel commented Jun 3, 2020

Complete Description of Issue

I want to have an optional validation. I'm using skip_if option when declaring property on a form. In the validation block I'm making it optional inside params so if the property is not passed to the validation, it would still validate successfully.

Steps to reproduce

Branch in my project: https://github.com/AndKiel/tournaments-api/tree/55eaf06f5e45e3969b0bc2720306d91e64aea6a3

Relevant files:

Test run focused on the form spec and contract spec (it still has focus on the form spec from the other issue): https://github.com/AndKiel/tournaments-api/pull/29/checks?check_run_id=735646841

Expected behavior

I'm expecting skipped property not to be passed to the validation at all. When using Dry::Validation::Contract and hash without a key is passed for the call it works as expected and validation passes. In Reform it's broken.

Actual behavior

Property key is still present and passed to validation with the value from validate() invocation despite the fact that property is declared with skip_if option.

System configuration

Reform version: v2.3.1 (latest)
dry-validation version: v1.5 (latest)

@AndKiel AndKiel changed the title Skipped property is still passed for validation as nil Skipped property is still passed for validation Jun 3, 2020
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

No branches or pull requests

1 participant