graphql-python / graphql-python/graphene-sqlalchemy

required should be inferred from the return type of a hybrid property

未關閉
#427 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
985
分支
224
PR 合併指標
30 天內沒有已合併 PR

描述

With a definition like:
```
@hybrid_property
def is_active(self) -> bool:
return self.state == 'ACTIVE'
```

The resulting graphql field type is currently marked `Boolean` unless overridden by `ORMField()`. Column properties correctly determine the nullability from the column definition. It seems reasonable to do the same for the hybrid_property based on the declared type. If the return type were `bool | None`, then it would be optional, otherwise it should be required.

貢獻指南

開啟貢獻指南

研究方向

先追蹤 hybrid_property 欄位如何轉換成 GraphQL 欄位,然後將這條路徑與現有的 column property 可空性推論進行比較。當宣告的 bool 回傳型別產生必要的 Boolean 欄位,而 bool | None 產生選用欄位,且兩種情況都有 coverage 時,變更即完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python, sqlalchemy
領域
api, backend
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。