【发布时间】:2022-07-27 06:04:07
【问题描述】:
我正在尝试使用 Netflix DGS 编写 java-graphql 客户端。 在开发者documentation 中,给出了以下示例代码,用于使用 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());
这里所有要查询的字段都在代码中给出,使用TicksConnectionProjectionRoot。
但是如果我想查询 15-20 个包含许多嵌套类型的字段,那就太麻烦了。有什么方法可以使用包含 Grapqhl 查询和所需字段的 .graphql 文件生成类似的 graphql 请求或投影。
【问题讨论】:
标签: java spring-boot graphql netflix-dgs