Skip to content

Filters should not be available on a @cypher directive field since they don't work #309

Open
@isstabb

Description

@isstabb

Describe the bug
Filters should not be available on a @cypher directive field since they don't work.

Test Case

GraphQL schema

type Person {
  id: ID
  name: String @cypher(statement:"RETURN this.name")
  age(mult:Int=13) : [Int] @cypher(statement:"RETURN this.age * mult")
  friends: [Person] @cypher(statement:"MATCH (this)-[:KNOWS]-(o) RETURN o")
  data: UserData @cypher(statement: "MATCH (this)-[:CREATED_MAP]->(m:Map) WITH collect({id: m.id, name: m.name}) AS mapsCreated, this RETURN {firstName: this.firstName, lastName: this.lastName, organization: this.organization, mapsCreated: mapsCreated}", passThrough:true)
}
type Query {
  person : [Person]
  p2: [Person] @cypher(statement:"MATCH (p:Person) RETURN p")
  p3(name:String): Person @cypher(statement:"MATCH (p:Person) WHERE p.name = name RETURN p")
  getUser(userId: ID): UserData @cypher(statement: "MATCH (u:User{id: {userId}})-[:CREATED_MAP]->(m:Map) WITH collect({id: m.id, name: m.name}) AS mapsCreated, u RETURN {firstName: u.firstName, lastName: u.lastName, organization: u.organization, mapsCreated: mapsCreated}", passThrough:true)
}

GraphQL request

{ person { friends(filter: {name: "won't work"}) { id } }}

Expected cypher query

Validation error

Additional context
It's unclear if it would even be possible to fix the root issue of the filters not working on cypher fields. On the one hand the statement in the cypher directive could be just about anything, how could a filter be injected? But on the other hand the type is known, so presumably it could be handled? In any case, at least until that could be fixed they should not be in the augmented schema.

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