I'm trying to write a java-graphql client using Netflix DGS. In the developer documentation, the following sample code is given for generating query using classes generated with DGS codegen.
GraphQLQueryRequest graphQLQueryRequest =
new GraphQLQueryRequest(
new TicksGraphQLQuery.Builder()
.first(first)
.after(after)
.build(),
new TicksConnectionProjectionRoot()
.edges()
.node()
.date()
.route()
.name()
.votes()
.starRating()
.parent()
.grade());
Here all the fields to be queried are given in the code itself, using TicksConnectionProjectionRoot
.
But if I want to query 15-20 fields with many nested types then it will be tiresome. Is there any way to generate the graphql request or a projection like this using a .graphql file containing the grapqhl query and fields needed.