サブセクションなしでgraphqlミューテーションリクエストを送信したい
mutation _ {
updateCurrentUser(fullName: "Syava", email: "fake@gmail.com")
}
そして私は得ています
{
"errors": [
{
"message": "Field \"updateCurrentUser\" of type \"User\" must have a sub selection.",
...
}
]
}
{ id } をリクエストに追加するとうまくいきますが、私はしたくありません
スキーマコードも
const userType = new GraphQLObjectType({
name: 'User',
fields: () => ({
id: { type: new GraphQLNonNull(GraphQLString) },
fullName: { type: GraphQLString },
email: { type: GraphQLString },
}),
});
type: userType,
args: {
fullName: { type: GraphQLString },
email: { type: new GraphQLNonNull(emailType) },
password: { type: GraphQLString },
},
resolve: async (root, { fullName, email, password }, { rootValue }) => {
const user = await User.findById(rootValue.req.user.id);
...
return user;
},