Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract requested fields from query/response #580

Open
StefanKoenigMUC opened this issue Jun 27, 2023 · 2 comments
Open

Extract requested fields from query/response #580

StefanKoenigMUC opened this issue Jun 27, 2023 · 2 comments

Comments

@StefanKoenigMUC
Copy link

Hi there,

I would like to ask if there is an easy way to access requested fields from an executed query?

My processing looks like that:

  1. receive query-string from external source
  2. create GraphQLRequest(string)
  3. client.SendQueryAsync<Dictionary<string, object>>(graphqlRequest)

For some reason I need the data which was requested, if the query returns data its quite easy (as I may use the json to derive fields from), but I now need that also for the case that no data is returned.

Thanks in advance,
Stefan

@rose-a
Copy link
Collaborator

rose-a commented Jun 27, 2023

You mean get a parsed representation of the query string on the client side?

There is currently no such functionality inside the client, it just passes the query string to the server as string.
Maybe you can utilize some functionality of GraphQL.NET to parse the query on the client side for your purposes. (Maybe start looking here, that's where it turns the query string into an object...)

@StefanKoenigMUC
Copy link
Author

tried now a different path - using the GraphQl-Parser and reconstructing it from the AST. May be a bit over the top, but is working now quite efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants