Reputation: 198
We have an established system which does not have a public API and we're evaluating GraphQL as a possible solution. We have a dozen or so different types, relations and possible actions/mutations.
From what we have read and from our experimentation's we can only have a single root node and all the mutations have to be listed here. We have many modules each with many entities and many actions available on each.
How are people organising large numbers of mutations? We're struggling to find examples of large applications using GraphQL that we can learn from.
Upvotes: 6
Views: 806
Reputation: 1128
Recently, I struggled with a similiar problem. I tried to organize my mutations in more nested way. The idea was to have something like this:
mutation {
users {
addUser(name: "Foo")
id
}
}
}
Unfortunately, this can't be done, therefore you should put all your mutations on Root mutation level.
The whole problem is discussed here https://github.com/graphql/graphql-js/issues/221
where @LeeByron explains
We do not support mutations at any level other than the top.
Upvotes: 2