这是我的架构QWS GraphQL架构
type Mutation {
createPost(input: postInput): Post
}
type Post {
id: ID!
title: String!
}
type Query {
singlePost(id: ID!): Post
getPost: [Post]
}
input postInput {
id: ID
title: String
}
schema {
query: Query
mutation: Mutation
}
当我使用以下代码查询(添加新数据)变体
mutation addPost {
createPost(input: {
title: "Test title"
}) {
title
}
}
它没有保存到数据库,并且显示的结果是
{
"data": {
"createPost": null
}
}
原因和解决方法
在列出其他API中的所有数据查询时也发生了