Skip to content

How to access the selectionSet from the Resolver ? #104

Open

Description

@Samsv77

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

Activity

  1. paulofaria commented on Feb 24, 2023

    @paulofaria
    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?

  2. Samsv77 commented on Feb 24, 2023

    @Samsv77
    Author

    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.

  3. ZirgVoice commented on Feb 24, 2023

    @ZirgVoice

    Use DataLoader there is an example

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions