I am working with a GraphQL API provided by an upstream system. In my application, I need to dynamically fetch the possible values for an argument in the GraphQL query. The upstream system’s team has defined an enum type for this argument, containing a list of possible values.
For example, let’s say the argument is country, and the enum contains a list of countries.
How can I programmatically retrieve these enum values in Java so that I can dynamically construct my GraphQL queries?
Here’s an overview of what I’m trying to achieve:
1-Query the GraphQL schema to fetch the possible values for the country argument.
2-Use these values to dynamically construct GraphQL queries.
3-Execute the constructed queries against the GraphQL API.
I’m using the graphql-java library for handling GraphQL operations in my Java application.
Any help or pointers would be greatly appreciated! Thanks in advance.