I ended up writing a rule, but is it possible to achieve it without a rule?
defmodule Contract do
use Drops.Contract
schema do
%{
required(:tags) => list(:string, [:filled?])
}
end
rule(:tags_filled, %{tags: []}) do
{:error, "tags must not be empty"}
end
end
I'm struggling to define a contract to validate a list of strings where each string must be filled, and the minimum size of the list is 1.
I ended up writing a rule, but is it possible to achieve it without a rule?