Skip to content

Instantly share code, notes, and snippets.

@dmi3coder
Created April 29, 2020 09:21
Show Gist options
  • Save dmi3coder/75d5814206629fe46319e369edd00864 to your computer and use it in GitHub Desktop.
Save dmi3coder/75d5814206629fe46319e369edd00864 to your computer and use it in GitHub Desktop.
Example of createGraphQL method in Quarkus GraphQL example
private GraphQL createGraphQL() throws Exception {
TypeDefinitionRegistry teamsSchema = getTeamSchema();
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring()
.type("Query",
builder -> builder.dataFetcher("allTeams", new VertxDataFetcher<>(this::getAllTeams))
).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(teamsSchema, runtimeWiring);
return GraphQL.newGraphQL(graphQLSchema).build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment