[Feature] Disable a graphql filter if the variable is not set
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Comienza rastreando el manejo de filtros GraphQL de graph-node para las variables omitidas y compáralo con el comportamiento de la API pública mostrado en los dos ejemplos de curl. Se considerará terminado cuando una variable omitida desactive su filtro en lugar de producir una condición de igualdad con null, y el comportamiento de la consulta de ejemplo tenga cobertura de pruebas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 3.2k
- Forks
- 1.1k
- Merge medio
- 4 d 1 h
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de graphprotocol/graph-node
-
current: include emits an all-null bucket for dimensionless aggregations, nulling the whole response Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
graphprotocol/graph-node#6719 ·
-
RUSTSEC-2026-0194: Quadratic run time when checking a start tag for duplicate attribute names Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
graphprotocol/graph-node#6673 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
graphprotocol/graph-node#6650 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
graphprotocol/graph-node#6722 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
graphprotocol/graph-node#6721 ·
Todos los issues de graphprotocol/graph-node
Issues similares
-
risk:low runtime status:in-progress type:test
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
EricSpencer00/Resilient#4835 · 1 comentario ·
-
agent:ready documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
cesarferreira/stax#890 ·
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100