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

Incorrect mutation translation for IDs with @property #299

Closed
mcmathews opened this issue Sep 7, 2023 · 0 comments · Fixed by #300
Closed

Incorrect mutation translation for IDs with @property #299

mcmathews opened this issue Sep 7, 2023 · 0 comments · Fixed by #300

Comments

@mcmathews
Copy link
Contributor

Describe the bug
Mutations are not being properly translated to cypher when the ID property includes a @property alias. This affects updates, merges, and deletes on nodes, and adds/deletes on edges.

Test Case

GraphQL schema

type Person {
    id: ID! @property(name: "~id")
    name: String
    actedIn: [Movie!]! @relation(name: "ACTED_IN", direction:OUT)
}

type Movie {
    title: String!
}

GraphQL request

mutation {
  mergePerson(id: "test-id", name: "test-name") {
    id
  }
}

Expected cypher query

MERGE (mergePerson:Person {
	`~id`: $mergePersonId
})
SET mergePerson += {
	name: $mergePersonName
}
WITH mergePerson
RETURN mergePerson {
	id: mergePerson.`~id`
} AS mergePerson

Expected cypher params

{
  "mergePersonId": "test-id",
  "mergePersonName": "test-name"
}

Neo4j test data
N/A

Expected GraphQL response
N/A

Actual cypher query

MERGE (mergePerson:Person {
	id: $mergePersonId
})
SET mergePerson += {
	name: $mergePersonName
}
WITH mergePerson
RETURN mergePerson {
	id: mergePerson.`~id`
} AS mergePerson

Additional context
None

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

Successfully merging a pull request may close this issue.

1 participant