I would like to “run” a rule only when the attribute/key is truthy, so something like:
class Search < Dry::Validation::Contract params do optional(:email).value(:string) end rule(:email) do key? && SomeLogicForValidation(value) end end
Here I would like to get rid of “key?” somehow.
When I try with early return like
return unless key? I’m getting an error:
Is it already possible somehow?