0

次のエラーが表示されます。

{
  "errors": [
    {
      "message": "Unknown argument \"project_id\" on field" +
                 \"get_project_detail_summary\" of type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 30
        }
      ]
    }
  ]
}

次のクエリを使用します。

query GetProjectDetailSummary($project_id: Int) {
  get_project_detail_summary(project_id: $project_id) {
    comments {
      ... on ManagerCommentNode {
        id
        text
        created
      }
      ... on VendorCommentNode {
        id
        text
        created
      }
      ... on TenantCommentNode {
        id
        text
        created
      }
    }
  }
}

次のバックエンド コードでは、ブレークポイントに到達するにはどうすればよいですか? または数値を指定してカスタム データを送り返すにはどうすればよいですか?:

class CommentsUnion(graphene.types.union.Union):
    class Meta:
        name = 'CommentsUnion'
        types = (ManagerCommentNode, VendorCommentNode, TenantCommentNode, )


class ProjectSummaryInput(graphene.InputObjectType):
    project_id = graphene.Int()


class ProjectSummaryNode(graphene.ObjectType):
    Input = ProjectSummaryInput

    project_id = graphene.Int()
    comments = graphene.List(CommentsUnion)

    @classmethod
    def resolve_comments(self, *args, **kwargs):
        import pdb;pdb.set_trace()
        return ProjectSummary.select_related('comments').objects.filter(comments__created__lt=dt)

class Query(graphene.ObjectType):
    get_project_detail_summary = Field(ProjectSummaryNode)

4

1 に答える 1