Code interface vs domain resource block
I’ve read the docs a few times and I can’t tell whether code interfaces are recommended in Ash 3. I seem to remember that they are a vestige of previous versions but I don’t see any mention that they are deprecated or discouraged. Is there something that code interfaces can do that I can’t do in a domain resource block?
6 Replies
define functions on the domain or resource module for your actions
they're not deprecated or discouraged at all
They are both code interfaces. just changes which module you call them on. use the domain one if you aren't sure
I use domain for actions that should be callable from outside the domain and resource for actions that should only be called internally of the domain
I currently don’t use the phrase “code interface” in my code. I know conceptually I’m defining a code interface in the domain module. I’m really asking about the dialect, especially what I can ignore without FOMO
Solution
I don't really use it as well. I mostly just think about them as functions
When I tried to vibe code it with usage rules, Claude literally created a code interface and I changed it to “regular” functions (inside a resource block so not exactly vanilla Elixir), but I didn’t necessarily know what I was doing either