【发布时间】:2021-10-04 15:54:36
【问题描述】:
字段级别的 cypher 指令不能用作 expected。
小例子:
type Question {
id: ID! @id
required: Boolean
testing(someId: ID!): Boolean
@cypher(statement: """
MATCH (q:Question {id:$someId}) RETURN q.required
""")
}
在运行以下查询时,我遇到了错误。
{
Question {
testing(someId: "12345678-1234-1234-1234-0123456789ab")
}
}
这是在 Apollo Playground 中看到的错误日志:
{ “错误”:[ { "message": "无效输入 '_someId': 预期\n "!="\n "%"\n ""\n "+"\n ","\n "-"\n "。" \n "/"\n ":"\n ""\n "="\n "=~"\n ">"\n ">="\n "AND"\n "CONTAINS"\n "ENDS"\n "IN"\n "IS"\n "OR"\n "STARTS"\n "XOR"\n "["\n "^"\n "}"(第 1 行,第 195 列 (偏移量:194))\n“匹配(
question:Question)返回question{测试:apoc.cypher.runFirstColumn("MATCH (q:Question {id:$someId}) 返回 q.required", {this: question, cypherParams: $cypherParams, someId: $1_someId}, false)} ASquestion"\n
^", “地点”:[ { “线”:2, “列”:3 } ], “小路”: [ “题” ], “扩展”:{ “代码”:“INTERNAL_SERVER_ERROR”, “例外”: { "code": "Neo.ClientError.Statement.SyntaxError", "name": "Neo4jError", “堆栈跟踪”: [ "Neo4jError: 无效输入 '_someId': 预期", " "!="", " "%"", " """, " "+"", " ","", " "-"", " "."", " "/"", " ":"", " """, " "="", " "=~"", " ">"", " ">="", “ “和””, " "包含"", " "结束"", “ “在””, “ “是””, “ “要么””, " "开始"", " "异或"", " "["", " "^"", “”}“(第 1 行,第 195 列(偏移量:194))”, ""MATCH (question:Question) 返回question{测试:apoc.cypher.runFirstColumn("MATCH (q:Question {id:$someId}) 返回 q.required", {this: question, cypherParams: $cypherParams, someId: $1_someId}, false)} ASquestion"", "^", “:”, "在 captureStacktrace (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/result.js:239:17)", “在新结果(/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/result.js:59:23)”, “在 newCompletedResult (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:372:12)”, “在 Object.run (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:226:20)”, "在 Transaction.run (/home/m1/citizentric/grand-housing/node_modules/neo4j-driver-core/lib/transaction.js:98:34)", “在_callee3$(/home/m1/citizentric/grand-housing/node_modules/neo4j-graphql-js/dist/index.js:226:35)”, “在tryCatch(/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:63:40)”, "在 Generator.invoke [as _invoke] (/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:293:22)", "在 Generator.next (/home/m1/citizentric/grand-housing/node_modules/regenerator-runtime/runtime.js:118:21)", " 在 asyncGeneratorStep (/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:5:24)", “在_next(/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:27:9)”, " 在 /home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:34:7", “在新的承诺()”, " 在新 F (/home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/node_modules/core-js/library/modules/_export.js:36:28)", " 在 /home/m1/citizentric/grand-housing/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator/index.js:23:12", “在/home/m1/citizentric/grand-housing/node_modules/neo4j-graphql-js/dist/index.js:241:30” ] } } } ], “数据”: { “问题”:null } }
我的 package.json 包含以下版本:
"apollo-server": "^2.25.0",
"apollo-server-core": "^2.25.0",
"graphql-tag": "^2.12.5",
"neo4j-driver": "^4.3.1",
"neo4j-graphql-js": "^2.19.2",
顶级查询(带参数)和带有密码装饰器的字段级查询只要不接受参数就可以正常工作。 我的印象是这在以前就已经奏效了。
【问题讨论】:
标签: neo4j graphql cypher apollo-server grandstack