graphql-python / graphql-python/graphene-mongo
No ability to get QuerySet in relay.Connection when use custom resolver in graphene.ObjectType
- 主要言語
- Python
- スター
- 287
- フォーク
- 111
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When I want to add some custom resolver (some complicated filter for example) for graphene.ObjectType I will lose opportunity to get filtered count number in Connection and etc. Example:
```
class Connection(relay.Connection):
"""Connection class"""
class Meta:
"""Meta class"""
abstract = True
total_count = graphene.Int()
def resolve_total_count(root, info, **kwargs):
"""Counts total number of documents with filters"""
return root.iterable.count()
class SomeModel(MongoengineObjectType):
class Meta:
connection_class = Connection
class SomeQueryRely(graphene.ObjectType):
q = MongoengineConnectionField(SomeModel, filter_one = graphene.String(name="filter_one"), filter_two =graphene.String(name="filter_two"))
def resolve_q(self, info: GraphQLResolveInfo, **kwargs):
query: QuerySet = info.context.queryset
QuerySet.filter(Q(filter_one=kwargs["filter_one"]) | Q(filter_two=kwargs["filter_two"]))
return query
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start by tracing the custom resolver through MongoengineConnectionField and relay.Connection, focusing on how the resolver's QuerySet reaches the connection. Reproduce the example with filter_one and filter_two, then verify that the filtered QuerySet remains available for total_count and related connection fields.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api, database
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100