AshGraphql Manage Relationships with multiple actions
Hello, I'm using the AshGraphql
managed_relationships
DSL to allow a GraphQL mutation to update relationship data on a resource. I works fine with the :create
action, but on adding the similar code for the :update
action, it gives errors. Here are the relevant parts of the resource module:
With the code above, there is a compiler error, Type name "CreateWebSiteComponentsInput" is not unique.
. What do I need to change to make this work?
I read the documentation about Graphql managed relationships. It's not all clicking yet for me.
https://ash-hq.org/docs/dsl/ash-resource#graphql-managed_relationships7 Replies
🤔
Something seems strange there
I'm still not sure exactly why this would cause your issue, but
create :update do
is probably not what you want
I don't think that will fix it though. Or if it does, then its doing something wrong I think
ah, crap
Thats not how we should be doing that 😢
It should be:
So fixing your action type will actually fix the issueFixing my action type? What would that look like?
well, you have
create :update
which I assume you mean to be an update action
i.e update :update
Oh!
So that will "fix" it, but really we ought to make this whole thing better. Probably the only thing I can do is add a new configuration and warn about it at compile time if it isn't set.
Okay, got it. Yeah, I'm still getting used to setting up actions. Thanks!
I'm going to release a new version of
ash_graphql
soon that warns about these type names and chooses a better name if you supply the proper config
Okay so I've released a new version of ash_graphql
0.23.0
that fixes these generated type names, and shows a warning guiding users in that direction
You may want to upgrade before you get too far in