Can not use Ash Resource action with Ash Admin without Attributes
I have defined an ash resource that represents a remote api. I have an action that makes a specific query to the API and use typed structs for the result. I'd like to be able to interact with this through ash admin. But it is giving me an error that there's no struct. This appears to be because I have no attributes on this resource. Must I declare attributes to the resource? Is there a flaw in my approach?
The moment I add the following to my resource, it works fine:
I may be going about this completely incorrectly, I would be interested in ANY feedback as this is exploratory work.
Resource
Domain
Error
Solution:Jump to solution
Short version: yes, you need to declare at least one attribute so Ash can generate a struct for your resource
5 Replies
Solution
Short version: yes, you need to declare at least one attribute so Ash can generate a struct for your resource
See this for an iin-depth explanation: https://deepwiki.com/search/i-have-defined-an-ash-resource_a6759b09-d4df-4751-b6ba-8d98f32130eb?mode=fast
DeepWiki
Search | DeepWiki
DeepWiki provides up-to-date documentation you can talk to, for every repo in the world. Think Deep Research for GitHub - powered by Devin.
May I ask, would you consider this approach? Would you prefer a single ash resource for a single api endpoint, or would you pefer to not have ash resources manage these kind of api calls? As I mentioned, this is fully exploratory work at this moment. I'm just experimenting with Ash.
Yeah, the thing with Ash is, even if what you're doing doesn't map 100% to the concept of a resource, you get the whole ecosystem for free. For example, that action you wrote can become an AI tool with like one extra line. Also, a TS interface or GraphQL operation, or whatever really. With a couple of extra config lines.
So yes, it does make sense doing it this way, for me at least
Thanks for the feedback. I'm currently trying to just.. jam everything into Ash and see where I can find cracks tbh.