Dus*_*Sun 5 graphql graphene-python graphql-python
我正在关注https://www.howtographql.com/graphql-python/4-authentication/上的 graphql-python 教程。但是,我收到 3 个错误,提示“无法在类型“CreateUser”上查询字段“id”。” 我基本上复制了教程中的所有源代码,并且在发布到此处之前仔细检查了我的 Python 代码。我使用了相同版本的 Django、Graphene 和其他包。我使用Windows 10和Python3.7。我怎样才能传递错误?
突变:
mutation {
createUser (
username: "abc",
email: "abc@example.com",
password: "123456"
){
id
username
password
}
}
Run Code Online (Sandbox Code Playgroud)
回复:
{
"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
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
您的查询中缺少一个级别:
mutation {
createUser (
username: "abc",
email: "abc@example.com",
password: "123456"
){
user {
id
username
password
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6905 次 |
最近记录: |