无效的输入' on o':\ n \*\ \ \ n \ \;创建突变时参数
我创建了一个Neo4J GraphQl API,该API从事CRUD操作并试图实现突变,但我正在收到此错误,并且不知道为什么会发生这种错误。
我在此实现此突变时并不面临任何问题。但是,当我尝试自己的示例时,我会遇到此错误并且无法解决。
{
"errors": [
{
"message": "Invalid input 'on': expected\n \"*\"\n \"]\"\n \"{\"\n \"|\"\n a parameter (line 11, column 26 (offset: 360))\n\"MERGE (this0)-[:Activity on]->(this0_activityonDisease0_node)\"\n ^",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createUsers"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"code": "Neo.ClientError.Statement.SyntaxError",
"name": "Neo4jError",
"stacktrace": [
"Neo4jError: Invalid input 'on': expected",
" \"*\"",
" \"]\"",
" \"{\"",
" \"|\"",
" a parameter (line 11, column 26 (offset: 360))",
"\"MERGE (this0)-[:Activity on]->(this0_activityonDisease0_node)\"",
" ^",
"",
" at captureStacktrace (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\result.js:239:17)",
" at new Result (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\result.js:59:23)",
" at newCompletedResult (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:433:12)",
" at Object.run (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:287:20)",
" at Transaction.run (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:137:34)",
" at execute (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\@neo4j\\graphql\\dist\\utils\\execute.js:87:51)",
" at resolve (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\@neo4j\\graphql\\dist\\schema\\resolvers\\mutation\\create.js:34:57)",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)"
]
}
}
}
],
"data": null
}
类型定义
和突变
我正在使用。
const typeDefs = gql`
type Disease {
name: String
medication: String
period: String
userActivityon: User @relationship(type: "Activity on", direction: IN)
}
type User {
name: String
age: Int
sex: String
weight: Int
smoking: Boolean
drinking: Boolean
nationality: String
birth_type: String
activityonDisease: Disease @relationship(type: "Activity on", direction: OUT)
}
`;
mutation{
createUsers(input: {
name:"harsha"
age:22
sex:"male"
activityonDisease:{create:{node:{
name:"cold"
medication:"months"
}}}
}) {
users {
name
age
activityonDisease {
name
medication
}
}
}
}
有人可以指出我做错了什么。
I have created a neo4j graphql API which does CRUD operations and was trying to implement mutations but i am receiving this error and don't know why this is happening.
I am not facing any problem implementing mutations from this page. But when I try my own example I am getting this error and unable to resolve it.
{
"errors": [
{
"message": "Invalid input 'on': expected\n \"*\"\n \"]\"\n \"{\"\n \"|\"\n a parameter (line 11, column 26 (offset: 360))\n\"MERGE (this0)-[:Activity on]->(this0_activityonDisease0_node)\"\n ^",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createUsers"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"code": "Neo.ClientError.Statement.SyntaxError",
"name": "Neo4jError",
"stacktrace": [
"Neo4jError: Invalid input 'on': expected",
" \"*\"",
" \"]\"",
" \"{\"",
" \"|\"",
" a parameter (line 11, column 26 (offset: 360))",
"\"MERGE (this0)-[:Activity on]->(this0_activityonDisease0_node)\"",
" ^",
"",
" at captureStacktrace (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\result.js:239:17)",
" at new Result (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\result.js:59:23)",
" at newCompletedResult (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:433:12)",
" at Object.run (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:287:20)",
" at Transaction.run (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\neo4j-driver-core\\lib\\transaction.js:137:34)",
" at execute (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\@neo4j\\graphql\\dist\\utils\\execute.js:87:51)",
" at resolve (C:\\Users\\DELL\\Documents\\GitHub\\graphql-testing\\node_modules\\@neo4j\\graphql\\dist\\schema\\resolvers\\mutation\\create.js:34:57)",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)"
]
}
}
}
],
"data": null
}
type definitions
and mutations
I am using are given below.
const typeDefs = gql`
type Disease {
name: String
medication: String
period: String
userActivityon: User @relationship(type: "Activity on", direction: IN)
}
type User {
name: String
age: Int
sex: String
weight: Int
smoking: Boolean
drinking: Boolean
nationality: String
birth_type: String
activityonDisease: Disease @relationship(type: "Activity on", direction: OUT)
}
`;
mutation{
createUsers(input: {
name:"harsha"
age:22
sex:"male"
activityonDisease:{create:{node:{
name:"cold"
medication:"months"
}}}
}) {
users {
name
age
activityonDisease {
name
medication
}
}
}
}
can some one point out where I am doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在为
关系类型
提供空间分离的单词,例如:这会导致错误。如果您想对
关系类型
使用多个单词,请通过下划线将它们分开,并保留所有字母资本,这是推荐的方法。尝试这样定义的任何地方都这样尝试:You are providing space separated words for
relationship type
, like this:This is causing the error. If you want to use multiple words for a
relationship type
, separate them by underscore, and keep all the letters capital, it's the recommended approach. Try like this, wherever relationships are defined: