I have a Phoenix Live component that renders multiple string inputs to match the {:array, :string} Ash type:
Previously my codebase was using Ecto, and I’ve found a difference in the way empty_values works between the two: in Ecto, all empty values found in empty_values/0 are removed from the list, whereas in Ash the empty_values constraint is matched directly against the list.
My first guess was to declare my resource attribute as follows:
attribute :skills, {:array, :string}, constraints: [empty_values: [[nil], [""]]]
which works fine if the user does not fill the default blank line on the form.
However, if another blank line is added, or if blank lines are mixed with filled ones, they are inserted as nil in the database:
I’m looking for a way to trim these values in the same way I would in Ecto, but from reading the documentation and reading the code, it doesn’t seem to me like it’s possible.
I’d like to know if there’s a motivation behind this design choice, or if a discussion & PR to make that possible could be entertained (if so, I’d be more than happy to contribute to this amazing framework
).
Thanks!


























