我正在尝试使用 GraphQL 在 Neo4j 中的节点之间创建关系。突变应该是什么样的?
Schema 显示它应该是这样的。
AddPersonRoll(
from: _PersonInput!
to: _RollInput!
): _AddPersonRollPayload
我试过了
mutation {
AddPersonRoll(
from: {
id: "be91aaca-944d-49f7-b3fd-c89ad454d5ab"
}
to: {
id: "8726255f-b6b6-4299-ba01-95f6d4ef2be7"
}
) {
from {
id
name
}
to {
id
name
}
}
}
它奏效了。但是当我尝试将 var 放入查询中时,我得到了
{
"error": "Failed to execute 'fetch' on 'Window': Invalid name"
}
代码是
mutation AddPersonRoll($PersonInput: ID!, $RollInput: ID!){
AddPersonRoll(
from: {
id: $PersonInput
}
to: {
id: $RollInput
}
) {
from {
id
name
}
to {
id
name
}
}
}
{
"PersonInput": "3cc70aca-9e07-4bbd-acb2-92670b4d1b0d",
"RollInput": "8726255f-b6b6-4299-ba01-95f6d4ef2be7"
}