[英]How to access the complete runtime GraphQLSchema object with Netflix DGS?
I need to access the complete GraphQLSchema
object outside GraphQL request handling.我需要在 GraphQL 请求处理之外访问完整的
GraphQLSchema
object。 When I used graphql-java directly I was in full control and had the control of this.当我直接使用 graphql-java 时,我可以完全控制并控制它。 Right now I need to accomplish the same with Netflix DGS and can't find how to do so (and keep up with runtime changes/reloading later).
现在我需要用 Netflix DGS 完成同样的事情,但找不到如何做到这一点(并跟上运行时更改/稍后重新加载)。
For more context - I need to do a few things with this - one is to create a complete, downloadable SDL version of the schema (ie not the same as federation _service { sdl }
) and also gather and expose some directive-driven metadata differently, since I can't introspect it:( from the client...对于更多上下文——我需要为此做一些事情——一个是创建一个完整的、可下载的 SDL 版本的模式(即与 federation
_service { sdl }
不同),并以不同的方式收集和公开一些指令驱动的元数据,因为我无法反省它:(来自客户......
You can use DgsDataFetchingEnvironment您可以使用 DgsDataFetchingEnvironment
@DgsQuery
public Student getStudent(DgsDataFetchingEnvironment dfe) {
GraphQLSchema schema = dfe.getGraphQLSchema();
//if you want to know which fields are selected in query
DataFetchingFieldSelectionSet fields = dfe.getSelectionSet();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.