Skip to content

QueryDslDataFetcher and QueryByExampleDataFetcher return empty property selection list for cursor connection #723

Closed
@meistermeier

Description

@meistermeier

While I am doing the last steps to also bring complete scrolling support for Spring GraphQL into Spring Data Neo4j, I came across this line:

queryToUse = queryToUse.project(buildPropertyPaths(env.getSelectionSet(), resultType));

Given a (partial) schema like this:

type Query {
    movies(first:Int, after:String, last:Int, before:String): MovieConnection
}
type MovieConnection {
    edges: [MovieEdge]!
    pageInfo: PageInfo!
}
type MovieEdge {
    node: Movie!
    cursor: String!
}
type Movie {
    id: ID!
    #...
    actors: [Person]
    directors: [Person]
}

and an actual query like this:

{
  movies(first:3){
    pageInfo {
      hasPreviousPage
      hasNextPage
      endCursor
    }
   edges {
      cursor
      node {
        title
        id
        actors
        {
          name
        }
      }
    }
  }
}

The selection set of course contains the requested paths that does not match up with the entity (Movie) at all. In fact the paths look like MovieConnection.edges/MovieEdge.node/Movie.actors . As a consequence buildPropertyPaths will return 0 properties.
In Spring Data Neo4j we process those properties to reduce the amount of data and related nodes/entities that gets loaded. But in this case we can only return "everything" because there is no filter in place.
Would it be possible to make the method buildPropertyPaths resp. the underlying methods aware of the cursor connection? Or issue another subsequent call before execution with this meta-information (I am aware that this would require a new method in Spring Data Commons)?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions