Skip to content

Instantly share code, notes, and snippets.

@nwillc
Last active October 13, 2016 14:23
Show Gist options
  • Save nwillc/a66829bc83295122513b741d71a71105 to your computer and use it in GitHub Desktop.
Save nwillc/a66829bc83295122513b741d71a71105 to your computer and use it in GitHub Desktop.
return newObject()
.name("mutation")
.field(newFieldDefinition()
.name("category")
.type(new GraphQLTypeReference("category"))
.argument(newArgument()
.name("key")
.type(new GraphQLNonNull(GraphQLString))
.build())
.argument(newArgument()
.name("name")
.type(new GraphQLNonNull(GraphQLString))
.build())
.dataFetcher(env -> {
Category category = new Category(env.getArgument("key"),
env.getArgument("name"));
categoryDao.save(category);
return category;
})
.build())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment