Skip to content

Incorrect mutation translation for IDs with @property #299

Closed
@mcmathews

Description

@mcmathews

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

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