-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
OK, mutations
are queries
for manipulating data. If so then my root query
and root mutation
tree should look similar and they both should allow nested fields (nested mutations). I was playing with this (using express-graphql) and it works.
Example:
// PUT /projects/:project_id/products/:id
mutation {
findProject(id: 1) { // make sure that the project exists and we can access it before mutating data
updateProduct(id: 1, name: "Foo") { // the resolve function receives a valid `project` as the first arg
id
}
}
}
Is this a valid example? Should mutations be nested like this? If no, how should I handle nested resources? I can not find any real-life example that would mutate nested resources. All examples define mutations only on the first level (fields on the root mutation).
felipe-gdr, Fi1osof, luckymark, huysentruitw, udayrajMT and 5 moreudayrajMT
Metadata
Metadata
Assignees
Labels
No labels