Imagine a module like this:
defmodule ErrorContainer do
@moduledoc false
use Ash.TypedStruct
typed_struct do
field :marker, :uuid_v7 do
allow_nil? false
default &Ash.UUIDv7.generate/0
end
field :error, :term, allow_nil?: false
end
end
Looking at the documentation and Ash.TypedStruct code, this should be supported.
In file ash/lib/ash/typed_struct.ex:92, it basically says in the typespec that using a function as a default value is supported: default: nil | term | (-> term),
But, when i try to create the object, I get an error:
iex(1)> ErrorContainer.new(error: :blibs)
{:error,
%Ash.Error.Changes.InvalidAttribute{
field: :marker,
message: "is invalid",
private_vars: nil,
value: nil,
has_value?: true,
splode: nil,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :invalid
}}
Is this a bug or an I doing something wrong?






















