graphql-python / graphql-python/graphene-sqlalchemy

AssertionError: Found different types with the same name in the schema

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

描述

I have two Classes Products and SalableProducts in my Models (SalableProducts inherits from Products so it has every field of it's database), in my Schema here is what i did

```python
class Product(SQLAlchemyObjectType):
class Meta:
model = ProductModel
interfaces = (relay.Node, )

class ProductConnections(relay.Connection):
class Meta:
node = Product
```
```python
class SalableProduct(SQLAlchemyObjectType):
class Meta:
model = SalableProductModel
interfaces = (relay.Node, )

class SalableProductConnections(relay.Connection):
class Meta:
node = SalableProduct
```

and here is my Query class :

```python
class Query(graphene.ObjectType):
node = relay.Node.Field()
all_products = SQLAlchemyConnectionField(ProductConnections)
all_salable_products = SQLAlchemyConnectionField(SalableProductConnections)

```

When i run my server i got this error :

AssertionError: Found different types with the same name in the schema: product_status, product_status.

貢獻指南

開啟貢獻指南

研究方向

從 issue 中所示的 Product 和 SalableProduct 的 SQLAlchemyObjectType 與 connection 定義開始,然後重現由 Query 欄位引發的伺服器啟動錯誤。追蹤 schema 如何建立 product_status 型別;當 schema 能夠在沒有重複型別 assertion 的情況下建構,同時保留兩個產品查詢時,即表示完成。

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

評估

技術堆疊
python, sqlalchemy
領域
api, backend-api-design
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

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

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