Ash FrameworkAF
Ash Framework7mo ago
11 replies
sanswork

AshMoney with Ash.Generator

Hi,

I have a resource that has an AshMoney attribute. When trying to create to with Ash.Generator I'm getting the following error

** (RuntimeError) generator/1 unimplemented for AshMoney.Types.Money
     stacktrace:
       (ash_money 0.2.0) /home/shawn/yc/ycm/deps/ash/lib/ash/type/type.ex:2038: AshMoney.Types.Money.generator/1
       (ash 3.5.6) lib/ash/generator/generator.ex:1017: Ash.Generator.attribute_generator/2
       (ash 3.5.6) lib/ash/generator/generator.ex:999: anonymous fn/5 in Ash.Generator.generate_attributes/5
       (elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
       (ash 3.5.6) lib/ash/generator/generator.ex:951: Ash.Generator.generate_attributes/5
       (ash 3.5.6) lib/ash/generator/generator.ex:264: Ash.Generator.changeset_generator/3
       test/ycm/outbound/target/processor_test.exs:19: Ycm.Outbound.Target.ProcessorTest.__ex_unit_setup_1/1
       test/ycm/outbound/target/processor_test.exs:1: Ycm.Outbound.Target.ProcessorTest.__ex_unit__/2


I'm tried wrapping it in a StreamData function with no change. I can't see anything in the docs about custom types with Ash.Generator. Do I need to patch AshMoney to provide the function or is there a general way to handle custom types?
Was this page helpful?