&引用;无法查询字段';id';在类型CreateUser“上;使用官方的Graphql教程
我将在上学习graphql python教程。然而,我得到3个错误,说“不能查询字段\“id\”类型\“CreateUser\”。我基本上复制了教程中的所有源代码,并在这里发布之前仔细检查了我的Python代码。我使用了Django、Graphene和其他软件包的相同版本。我使用Windows10和Python3.7。如何传递错误 突变:&引用;无法查询字段';id';在类型CreateUser“上;使用官方的Graphql教程,graphql,graphene-python,graphql-python,Graphql,Graphene Python,Graphql Python,我将在上学习graphql python教程。然而,我得到3个错误,说“不能查询字段\“id\”类型\“CreateUser\”。我基本上复制了教程中的所有源代码,并在这里发布之前仔细检查了我的Python代码。我使用了Django、Graphene和其他软件包的相同版本。我使用Windows10和Python3.7。如何传递错误 突变: mutation { createUser ( username: "abc", email: "abc@example.com",
mutation {
createUser (
username: "abc",
email: "abc@example.com",
password: "123456"
){
id
username
password
}
}
答复:
{
"errors": [
{
"message": "Cannot query field \"id\" on type \"CreateUser\".",
"locations": [
{
"line": 7,
"column": 5
}
]
},
{
"message": "Cannot query field \"username\" on type \"CreateUser\". Did you mean \"user\"?",
"locations": [
{
"line": 8,
"column": 5
}
]
},
{
"message": "Cannot query field \"password\" on type \"CreateUser\".",
"locations": [
{
"line": 9,
"column": 5
}
]
}
]
}
查询中缺少一个级别:
mutation {
createUser (
username: "abc",
email: "abc@example.com",
password: "123456"
){
user {
id
username
password
}
}
}