1

I need to access the complete GraphQLSchema object outside GraphQL request handling. When I used graphql-java directly I was in full control and had the control of this. 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).

For more context - I need to do a few things with this - one is to create a complete, downloadable SDL version of the schema (i.e. 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...

Learner
  • 1,215
  • 1
  • 11
  • 26

1 Answers1

0

You can use 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();
  }
Jags
  • 799
  • 7
  • 19
  • That is at request time, within a particular query. I need this independently of that - at or otherwise without GraphQL a request going on. – Learner Jul 27 '22 at 14:07