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

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

Open
isstabb opened this issue Dec 1, 2023 · 0 comments

Comments

@isstabb
Copy link
Contributor

isstabb commented Dec 1, 2023

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.

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

No branches or pull requests

1 participant