Hi,
I’d like to create a simple schema where a bar
field is needed if other foo
bar is not present. For example,
{foo: 'some value'}
should pass validation, but {baz: 'value'}
should not, because bar
is not present. In my mind, that would be something like
schema = Dry::Schema.Params do
optional(:foo) {nil?.then ( required(:bar).string ) }
end
Is that possible using only dry-validations
? Thanks in advance!