You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey. When I write my code I'm designing it not coding thus I have lots of questions :). Btw, I like your code style. How would you handle nested resources like /projects/:project_id/products/:id. All tutorials (not just yours) have mutations defined on the root mutation (no nesting). As I described here graphql/graphql-js#221 we could have nested resources the same way as we would do it in REST (nested query). I wonder if that logic is acceptable in graphql. I would like to see how others handle this case.
Example:
// PUT /projects/:project_id/products/:idmutation{// example 1findProject(id: 1){// make sure that the project exists and we can access it before mutating dataupdateProduct(id: 1,name: "Foo"){// the resolve function receives a valid `project` as the first argid}}// example 2updateProjectProduct(projectId: 10,name: "Product 1"){id}// example 3updateProjectProduct(projectId: 10,product: {name: "Product 1"}){id}}
Also, should the update or delete mutation return an object or null or {status: 'ok'} or else?
Thank you!
The text was updated successfully, but these errors were encountered:
In addition to input types, have mutator types? The idea is that if a mutator type is returned from a mutation requests, it is treated as an extension of the mutation request.
Hey. When I write my code I'm designing it not coding thus I have lots of questions :). Btw, I like your code style. How would you handle nested resources like
/projects/:project_id/products/:id
. All tutorials (not just yours) have mutations defined on the root mutation (no nesting). As I described here graphql/graphql-js#221 we could have nested resources the same way as we would do it in REST (nested query). I wonder if that logic is acceptable ingraphql
. I would like to see how others handle this case.Example:
Also, should the
update
ordelete
mutation return an object or null or{status: 'ok'}
or else?Thank you!
The text was updated successfully, but these errors were encountered: