Skip to content

How get selectionSet from DataFetchingEnvironment if selection is FragmentSpread #303

@shendepu

Description

@shendepu

DataFetchingEnvironment.fields has information of selected fields.

But when I run below query, I can't find a way to know the field selectionSet at emplPositionClasses field. Because it is explicit defined fragment, so the instance of selection in emplPositionClasses selectionSet is FragmentSpread. and there is no methods to get selectionSet on FragmentSpread.

For the other two type of selection, Field and InlineFragment, there are methods to get selectionSet, so inline fragment has no issue.

the field emplPositionClasses type is EmplPositionClassConnection

query {
  mantle {
    emplPositionClasses {
    	...EmplPositionClassesFragment
    }
  }
}

fragment EmplPositionClassesFragment on EmplPositionClassConnection {
  edges {
    node {
      id
      emplPositionClassId
      title
      description
    }
  }
}

So is it reasonable to also add getSelectionSet() method on class FragmentSpread?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions