[Feature] Disable a graphql filter if the variable is not set
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
調査の方向性
まず、graph-node における省略された変数の GraphQL フィルター処理を追跡し、2 つの curl の例に示されている公開 API の動作と比較します。省略された変数によって null との等価条件が生成されるのではなく、そのフィルターが無効になり、例のクエリの動作がテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Hi, I was running a graph-node of the latest stable version (v0.33.0), and an example-subgraph. After that, I was trying to request entities with GraphQL query like:
curl 'http://127.0.0.1:9000/subgraphs/name/example' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Origin: http://127.0.0.1:9000' \
-H 'Referer: http://127.0.0.1:9000/subgraphs/name/example/graphql' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
-H 'accept: application/json, multipart/mixed' \
-H 'content-type: application/json' \
-H 'sec-ch-ua: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"query":"query MyQuery($id: ID) {\n gravatars(first: 10, where: {id: $id}) {\n id\n }\n}","variables":{},"operationName":"MyQuery","extensions":{"headers":null}}' \
--compressed
For more clarity, we define a filter variable id but leave it alone without setting any value.
query MyQuery($id: ID) {
gravatars(first: 10, where: {id: $id}) {
id
}
}
In this case, the graph-node returns me nothing, looking like it takes the variable id as null, and queries the Postgres with the filter condition to check if id is equal to null.
Interestingly, while I was trying to simulate a similar action in our thegraph endpoint api.thegraph.com, even I didn't set any variables for id or symbol, the server would still response all entries regarding these filter variables as disabled.
curl 'https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2' \
-H 'authority: api.thegraph.com' \
-H 'accept: */*' \
-H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'content-type: application/json' \
-H 'origin: https://api.thegraph.com' \
-H 'referer: https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2' \
-H 'sec-ch-ua: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
--data-raw '{"operationName":"markets","variables":{},"query":"query markets($id: ID, $symbol: String) {\n markets(first: 7, where: {id: $id, symbol: $symbol}) {\n id\n symbol\n }\n}\n"}' \
--compressed
So, what is the main cause for this difference of GraphQL filter behavior between graph-node binary and our public api endpoint? Is it possible for graph-node to conform with the same behavior (disable a graphql filter if the variable is not set)?
This issue may also be relevant to #4112
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.
No response
Some information to help us out
- Tick this box if you plan on implementing this feature yourself.
- I have searched the issue tracker to make sure this issue is not a duplicate.
- 主要言語
- Rust
- スター
- 3.2k
- フォーク
- 1.1k
- 平均マージ
- 4日 1時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphprotocol/graph-node のほかの issue
-
current: include emits an all-null bucket for dimensionless aggregations, nulling the whole response オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
graphprotocol/graph-node#6719 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
graphprotocol/graph-node#6673 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
graphprotocol/graph-node#6650 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
graphprotocol/graph-node#6722 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
graphprotocol/graph-node#6721 ·
graphprotocol/graph-node の issue をすべて見る
似ている issue
-
risk:low runtime status:in-progress type:test
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
EricSpencer00/Resilient#4835 · コメント 1 件 ·
-
agent:ready documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
cesarferreira/stax#890 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100