Using Resource as an argument in Action Ash 2 -> Ash 3

I used this code in Ash 2 to add to a has_many relationship on a resource.

    update :append_modifier do
      argument :modifier, PointOfSale.Stores.Modifier, allow_nil?: false

      change manage_relationship(:modifier, :modifiers,
               on_match: :ignore,
               on_no_match: :create,
               on_lookup: :relate,
               on_missing: :ignore
             )
    end

I’m in the middle up upgrading to Ash 3 and I get this error when compiling:

** (RuntimeError) PointOfSale.Stores.Modifier is not a valid type.

1 Like
argument :modifier, :struct, allow_nil?: false, constraints: [instance_of: PointOfSale.Stores.Modifier]
2 Likes

There’s an Upgrade Guide which you might want to check, it also answers your question: Upgrade — ash v3.0.7

1 Like

Ah, thank you, I was looking at an older one or just missed it