If you write a rule in the following way:
Dry::Validation.Schema do
required(:email).filled?
end
No exception will be raised because filled?
will be accepted by method_missing
as a valid predicate
. Instead it will silently generate an empty rule without any validation.
This got me. I was a bit tired and I spent about 15 min trying to figure out what is wrong. I simply didn’t notice that I have a typo since I was expecting that a typo would give me an undefined method error.
I think that in such a case the gem should notice that the function call will have no effect and print a warning.
If you agree that it makes sense, I’d like to create the PR myself since I’d like to get a bit more familiar with the inner workings of dry validation.