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 (将#修改为@)