strawberry-graphql/strawberry-django

Relay: Wrap resolve_model_node with django_resolver

オープン

#402 opened on 2023/10/27

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)Python (152 件のフォーク)auto 404
enhancementhelp wantedquestion

Repository metrics

Stars
 (496 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Currently: https://github.com/strawberry-graphql/strawberry-graphql-django/blob/8f82b84141c182980b5001b4f0f562c787fe2dda/strawberry_django/relay.py#L395

Only the actual get/first methods are being wrapped for async safety.

There are cases where I need to access data not fetched yet in the custom get_queryset resolver (permissions, system settings, etc) defined up: https://github.com/strawberry-graphql/strawberry-graphql-django/blob/8f82b84141c182980b5001b4f0f562c787fe2dda/strawberry_django/relay.py#L380-L382

I went ahead and just wrapped the whole resolve_model_node resolver with django_resolver and didn't notice any difference.

I found this while trying to customize how a node is being resolved:

    node: relay.Node = relay.node()

コントリビューターガイド