From the course: Spring with GraphQL

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Mutations

Mutations

- [Instructor] That was very easy to get a GraphQL server up and running. We did it in about 15 minutes. But now we need to actually do more than just query the data, because very few services exist that don't have the ability to modify data. So that's our next step. Let's go create a mutation. All right. So let's open up hplus, source, main, resources, graphql. And let's open up our schema. Now, when you're building a mutation, you need to create a specific type for that mutation. And it's called an input. So we will create a CustomerInput. And our CustomerInput is basically going to be the exact same as the Customer, without the ID. Because in our case, the Customer itself gets its ID from the identity and that comes from the database. So we don't need to specify that on the input. Now, if you were going to use the exact same object to create it, you would still have to create another instance or use an…

Contents