diff --git a/lib/ash/embeddable_type.ex b/lib/ash/embeddable_type.ex index 6e2ab89a..e486e187 100644 --- a/lib/ash/embeddable_type.ex +++ b/lib/ash/embeddable_type.ex @@ -261,6 +261,10 @@ defmodule Ash.EmbeddableType do end end + def prepare_change(old_value, "", constraints) do + prepare_change(old_value, nil, constraints) + end + def prepare_change(_old_value, nil, _constraints) do {:ok, nil} end diff --git a/lib/ash/type/type.ex b/lib/ash/type/type.ex index d5890ae5..035d127c 100644 --- a/lib/ash/type/type.ex +++ b/lib/ash/type/type.ex @@ -260,6 +260,9 @@ defmodule Ash.Type do @spec cast_input(t(), term, constraints | nil) :: {:ok, term} | {:error, Keyword.t()} | :error def cast_input(type, term, constraints \\ []) + def cast_input({:array, type}, empty, constraints) when empty in [nil, ""], + do: cast_input({:array, type}, [], constraints) + def cast_input({:array, _type}, term, _) when not is_list(term) do {:error, message: "must be a list or a map of integer indices (string encoded or not) to values"}