我在我的酒瓶应用程序(https://github.com/graphql-python/graphene)和石墨烯文件上传(https://pypi.org/project/graphene-file-upload/)中使用了石墨烯包。我需要通过以下的突变来接收一个文件:
class Picture(graphene.Mutation):
class Arguments:
file = Upload(required=True)
numerical_id = graphene.Int()
def mutate(self, info, file):
... continues
class Mutations(graphene.ObjectType):
picture = Picture.Field()但是,当我通过阿波罗客户端(https://www.apollographql.com/docs/react/)发送突变时,我正在纠正这些错误:
Unknown type "Upload". Perhaps you meant "Float"?
Cannot query field "picture" on type "Mutations".有什么解决办法吗?提前谢谢你!
发布于 2020-10-22 01:43:51
你从graphene_file_upload.scalars导入上传了吗?您还需要确保修复连接到/graphql视图的视图函数。
发布于 2021-08-25 18:07:48
我花了几个小时试图弄清楚这一点,因为这种突变通过邮递员很好地发挥作用,但在从前面发送的时候就不起作用了。问题是,父组件使用的ApolloProvider与我期望的不同。
https://stackoverflow.com/questions/63662225
复制相似问题