"cannot query field 'id' on type CreateUser" 带有官方 Graphql 教程
"cannot query field 'id' on type CreateUser" with official Graphql tutorial
我正在关注 https://www.howtographql.com/graphql-python/4-authentication/ 上的 graphql-python 教程。但是,我收到 3 个错误,说 "Cannot query field \"id\" on type \"CreateUser\"."我基本上复制了教程中的所有源代码,并在发布到这里之前仔细检查了我的 Python 代码。并且我使用了相同版本的 Django、Graphene 和其他包。我使用 Windows 10 和 Python3.7。如何传递错误?
突变:
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
}
}
}
我正在关注 https://www.howtographql.com/graphql-python/4-authentication/ 上的 graphql-python 教程。但是,我收到 3 个错误,说 "Cannot query field \"id\" on type \"CreateUser\"."我基本上复制了教程中的所有源代码,并在发布到这里之前仔细检查了我的 Python 代码。并且我使用了相同版本的 Django、Graphene 和其他包。我使用 Windows 10 和 Python3.7。如何传递错误?
突变:
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
}
}
}