graphql-python / graphql-python/graphene-mongo
Problem with EmbeddedFiled (Can't query via graphql
- 主要言語
- Python
- スター
- 287
- フォーク
- 111
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi Guys, Currently I set up a simple model, schema, type as below. However, I don't know why when I use EmbeddedField it works in the runtime (It doesn't show any runtime error) but I can't operate any query on this field.
`Error messge`
"Cannot query field \"metadata\" on type \"Scenario\"
Environment:
Python3.6
Python3.8
Computer system
Mac: MacOC
Models.py
```
# EmbeddedDocument Models
class Scenario(EmbeddedDocument):
name = models.StringField(max_length=100)
creationDatetime = models.DateTimeField()
lastUpdateDatetime = models.DateTimeField()
data = models.DictField()
cancellation = models.BooleanField(default=False)
isDefault = models.BooleanField(default=False)
# Document Models
class View(Document):
name = models.StringField(max_length=100)
scenarios = models.EmbeddedDocumentListField(Scenario)
cancellation = models.BooleanField(default=False)
```
Types.py
```
class ViewType(MongoengineObjectType):
class Meta:
model = View
interfaces = (relay.Node,)
```
Schema.py
```
class Query(graphene.ObjectType):
node = Node.Field()
view = MongoengineConnectionField(ViewType)
views = graphene.List(ViewType)
def resolve_views(self, info, name):
return View.objects.get(name=name)
```
Also, I have tried the solution on this issue as well
https://github.com/graphql-python/graphene-mongo/issues/32
I will get an error when I declare the reference model
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず Models.py の EmbeddedDocument 定義と、Types.py の ViewType が Schema.py の Query フィールドを通じて View をどのように公開しているかを確認します。メタデータまたは埋め込み scenarios フィールドをクエリできないという報告を再現し、埋め込みデータをランタイムエラーなしでクエリ可能にするために、どのスキーマ動作を修正すべきかを特定します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- graphql, python
- 領域
- api, database
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100