微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python-graphene中的延迟加载查询和突变

如何解决python-graphene中的延迟加载查询和突变

由于本thread的启发,我试图创建一种机制来动态加载预定义目录和条件中的所有查询,变异等。

我创建了一个SchemaBuilder class,它加载了所有从BaseQueryBaseMutation继承的查询和突变,并创建了一个包含所有与预定义条件匹配的查询和突变的架构。

然后将该架构传递到我的flask应用程序以使用它。

目前,我正在为执行突变而努力。所以我写了a unit test to demonstrate the problem I am facing

These are the logs I get from executing the test

有趣的部分在第33行:


'message': 'UnkNown argument "user_data" on field "user" of type ' '"Mutation".

CreateUser Mutation确实有一个参数user_data,在我的烧瓶Graphql Web端点中可见,并且也根据我的日志记录输出加载了

2020-10-20 21:34:37,798 - core - MainThread - 20 - INFO - schema {
  query: Query
  mutation: Mutation
}

type createuserType {
  username: String
  email: String
  password: String
}

scalar DateTime

type Mutation {
  user: createuserType
}

interface Node {
  id: ID!
}

type Query {
  node(id: ID!): Node
  activeUsers: [UserType]
}

type UserType {
  id: ID!
  createdAt: DateTime!
  updatedAt: DateTime!
  firstname: String
  lastname: String
  username: String
  password: String
  email: String
}

在这里迷路了,我真的需要一些帮助!

谢谢 @atlasloewenherz

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。