简体   繁体   English

如何使用 Netflix DGS 访问完整的运行时 GraphQLSchema object?

[英]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.

相关问题 如何在 Netflix DGS 解析器中获取 header 信息 - how to get the header info in Netflix DGS resolver 如何在 Netflix DGS 框架中隐藏 graphQL 字段? - How to hide graphQL fields in Netflix DGS framework? 如何使用 Netflix DGS graphql-dgs-extended-scalars JSON 标量 (java/spring-boot, maven)? - How to use Netflix DGS graphql-dgs-extended-scalars JSON scalar (java/spring-boot, maven)? 如何将GraphQLSchema对象转换为类型定义 - How to Convert GraphQLSchema Object to Type Definitions 如何将现有的GraphQLSchema对象传递给Apollo makeExecutableSchema函数 - How to pass existing GraphQLSchema object to Apollo makeExecutableSchema function 如何从GraphQLSchema javascript对象获取.graphql文件? - how to obtain .graphql file from GraphQLSchema javascript object? 错误:无法使用来自另一个模块或领域的 GraphQLSchema“[object GraphQLSchema]” - Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm 如何将 GraphqlSchema 转换为联合模式? - How to convert GraphqlSchema into a Federation Schema? GraphQL netflix-dgs codegen generateJava 不必要地导入 java.util - GraphQL netflix-dgs codegen generateJava imports java.util unnecessarily 如何创建 DGS GraphQL 订阅 ActiveMQ 主题 - How to create a DGS GraphQL Subscription to an ActiveMQ Topic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM