Last active
October 13, 2016 14:04
-
-
Save nwillc/d5ff8b3f12ff674d1fc27897817f3a45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return newObject() | |
.name("query") | |
.field(newFieldDefinition() | |
.name("category") | |
.type(category) | |
.argument(newArgument() | |
.name("key") | |
.type(new GraphQLNonNull(GraphQLString)) | |
.build()) | |
.dataFetcher(environment -> categoryDao.findOne(environment.getArgument("key")).orElse(null)) | |
.build()) | |
.field(newFieldDefinition() | |
.name("categories") | |
.type(new GraphQLList(category)) | |
.dataFetcher(environment -> categoryDao.findAll().collect(Collectors.toList())) | |
.build()) | |
.build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment