0xPlaygrounds / 0xPlaygrounds/subgrounds

Not clear why JSON response receives an auto-generated key

オープン
#51 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
Python
スター
73
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

説明

**Describe the bug**
When calling the method `result = sg.query_json()`, the returned object looks roughly like this:

```
$result
[{'xcfb7c9c5f581c978': [{"title":"title1", "id":1}, {"title":"title2",id":2}
```

It's not clear to me (also could not find anything in the docs) why the results are indexed by this (apparently random) key. Isn't it easier to just return all flattened items?
I apologize if this behaviour is documented somewhere.

**To Reproduce**
- Query this subgraph https://api.thegraph.com/subgraphs/name/protofire/omen-xdai/graphql?query=query+%7B%0A++fixedProductMarketMakers%28first%3A2%2C%0A++++where%3A+%7B%0A++++++outcomes%3A+%5B%22Yes%22%2C%22No%22%5D%0A++++%7D%0A++%29+%7B%0A++++id%0A++++outcomes%0A++%7D%0A%7D (fetching `fixedProductMarketMakers`)

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Python version (please complete the following information):**
- 3.10.13

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Look at the sg.query_json() method in the subgrounds library to understand how GraphQL responses are processed. The issue mentions a random key in the JSON output; examine the response transformation logic. Check if there are existing tests for query_json to see the expected structure. Determine if the key is necessary for nested data or if results can be flattened as suggested.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql, python
領域
api, data
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。