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

How to access the selectionSet from the Resolver ? #104

Open
Samsv77 opened this issue Feb 23, 2023 · 3 comments
Open

How to access the selectionSet from the Resolver ? #104

Samsv77 opened this issue Feb 23, 2023 · 3 comments

Comments

@Samsv77
Copy link

Samsv77 commented Feb 23, 2023

Hi,
Is it possible to get the selectionSet in the Resolver ?
The selectionSet is a flat list of the fields that the user requested, for example,

family {
   name
   child {
     name
  }
}

Would give the selectionSet ["name", "child/name"]

Thank you

@paulofaria
Copy link
Member

As far as I remember, Graphiti doesn’t expose it, but the lower level GraphQL resolver exposes it. It is possible to provide that API, but it would make Graphiti’s API less concise. So back in the day I opted to not export it. Out of curiosity, why do you need it?

@Samsv77
Copy link
Author

Samsv77 commented Feb 24, 2023

I use it to know if I should explicitely pull the child information from the database. Since I have a large volume of data, I need to pull them in batch.
I am not sure how to handle it when using Vapor Fluent, to decide whether to pull the relationship or not based on the graphQL query.

@ZirgVoice
Copy link

Use DataLoader there is an example

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

No branches or pull requests

4 participants