graphql-python / graphql-python/graphene-sqlalchemy
Refactor SQLAlchemyConnectionField to use SQLAlchemyObjectType.get_query()
- 主要語言
- Python
- 星號
- 985
- 分支
- 223
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Right now, `SQLAlchemyConnectionField` uses the `get_query()` implementation in `graphene_sqlalchemy.utils`. The same code is in `SQLAlchemyObjectType`.
https://github.com/graphql-python/graphene-sqlalchemy/blob/1d353f71f4ff256dcf69a7a13a27e4865282b044/graphene_sqlalchemy/fields.py#L18-L20
https://github.com/graphql-python/graphene-sqlalchemy/blob/1d353f71f4ff256dcf69a7a13a27e4865282b044/graphene_sqlalchemy/types.py#L146-L149
This means that if someone wants to update the query for an `SQLAlchemyObjectType`, e.g. to implement permissions restrictions, they have to subclass not only `SQLAlchemyObjectType` but also `SQLAlchemyConnectionField`.
I suggest refactoring `SQLAlchemyConnectionField` to re-use the `get_query()` implementation of the `SQLAlchemyObjectType` it wraps. I'm willing to look into creating a PR if there is interest.
貢獻指南
研究方向
Start with the duplicated get_query implementations in graphene_sqlalchemy/fields.py (lines 18-20) and graphene_sqlalchemy/types.py (lines 146-149). Trace how SQLAlchemyConnectionField wraps an SQLAlchemyObjectType, then refactor the field to reuse that object's get_query implementation. Done means object-type query customizations, including permission restrictions, are honored without also subclassing SQLAlchemyConnectionField.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- graphql, python, sqlalchemy
- 領域
- api, backend
- Issue 類型
- 重構
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100