我正在尝试对我在 Sangria 中定义的本地 graphql 服务器执行查询。我有这样定义的突变:
val Mutation = ObjectType(
"Mutation", fields[DAO, Unit](
Field("addMovie", IntType,
arguments = Title :: Genre :: IMDBLink :: Nil,
resolve = ctx => ctx.ctx.addMovie(ctx.arg(Title) , ctx.arg(Genre), ctx.arg(IMDBLink)))
)
但是,当我尝试对它执行查询时,我收到此查询的任一语法错误:
mutation addMovieQuery {addMovie(title: "asd", genre: "asasdqw", IMDBLink: "$imdbLink") {}}
或者Field 'addMovie' of type 'Int' must not have a sub selection
在使用括号内的 id 运行查询时