mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: handle cases where union type is already atom
This commit is contained in:
parent
f53ca78f5c
commit
83d0e05bdc
1 changed files with 7 additions and 1 deletions
|
@ -254,7 +254,13 @@ defmodule Ash.Type.Union do
|
|||
def cast_stored(nil, _), do: {:ok, nil}
|
||||
|
||||
def cast_stored(%{"type" => type, "value" => value}, constraints) do
|
||||
type = String.to_existing_atom(type)
|
||||
type =
|
||||
if is_binary(type) do
|
||||
String.to_existing_atom(type)
|
||||
else
|
||||
type
|
||||
end
|
||||
|
||||
types = constraints[:types] || []
|
||||
|
||||
case Keyword.fetch(types, type) do
|
||||
|
|
Loading…
Reference in a new issue