【发布时间】:2020-03-20 13:59:12
【问题描述】:
我使用"apollo-server": "^2.9.11" 并具有以下架构以分段上传文件
type Mutation {
...
updateProfileImage(contact_id: ID!, file: Upload!): String!
}
当我使用graphql_flutter 2.1.0 客户端查询它时,我收到以下错误:
Unknown type 'contact_id', did you mean 'ContactType' or 'Contact'
虽然在我添加 contact_id 参数(我需要在解析器中)之前它正在使用 file 参数(流和上传文件)。
使用 Apollo 上传文件时是否有任何限制,例如不添加其他参数?还是有其他原因?
更新:查询
在颤振方面,我是这样发送的:
r”“”
mutation($contactId : contact_id , $file: Upload!){
uploadProfileImage(contact_id: $contactId ,file: $file)
}
“”"
虽然查询是这样的(文件正在上传):
r”“”
mutation($file: Upload!){
uploadProfileImage(file: $file)
}
“”"
但是在将 contact_id 参数添加到我的架构和查询后,我开始收到该错误。
【问题讨论】:
-
听起来您的查询格式不正确。请更新您的问题以包含实际发送查询的代码。
-
@DanielRearden 已更新。
-
那么...为什么
$contactId变量的类型是contact_id?据推测,如错误所示,您没有具有该名称的类型。 -
是的,我发布后才发现,谢谢 :)
标签: flutter graphql apollo apollo-server