mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: handle nil
in atomic array casting
This commit is contained in:
parent
58065c31cd
commit
960af4b887
1 changed files with 6 additions and 0 deletions
|
@ -1585,6 +1585,8 @@ defmodule Ash.Type do
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
def apply_atomic_constraints_array(nil, _), do: {:ok, nil}
|
||||||
|
|
||||||
def apply_atomic_constraints_array(new_value, constraints) when is_list(new_value) do
|
def apply_atomic_constraints_array(new_value, constraints) when is_list(new_value) do
|
||||||
new_value
|
new_value
|
||||||
|> Enum.reduce_while({:ok, []}, fn val, {:ok, vals} ->
|
|> Enum.reduce_while({:ok, []}, fn val, {:ok, vals} ->
|
||||||
|
@ -1620,6 +1622,10 @@ defmodule Ash.Type do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cast_atomic_array(nil, _) do
|
||||||
|
{:atomic, nil}
|
||||||
|
end
|
||||||
|
|
||||||
def cast_atomic_array(new_value, _constraints) do
|
def cast_atomic_array(new_value, _constraints) do
|
||||||
{:not_atomic, "Cannot cast a non-literal list atomically"}
|
{:not_atomic, "Cannot cast a non-literal list atomically"}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue