graphprotocol / graphprotocol/graph-node
Stricter subgraph schema validation
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 3.2k
- Fork
- 1.1k
- Merge medio
- 4g 1h
- PR unite (30g)
- 1
Descrizione
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
We currently allow a lot of names in schemas that either cause problems or that we want to deliberately forbid in order to give us a reserved namespace. Examples are:
-
Entity fields called
setandunset. AssemblyScript apparently allows things likeentity.set = "foo"which will replace the
set(key: string, value: Value)method in theEntitybase class with a string, which breaks all later attempts to assign fields in the same handler. -
Entity types and fields with a leading underscore (we have already introduced the special
_Schema_type and we want to move towards reserving names starting with underscores for Graph features.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Create a subgraph with a schema like this:
type Set @entity {
id: ID!
}
type SetCreation @entity {
id: ID!
set: Set!
name: String!
}
then write a handler that does the following:
let creation = new SetCreation("foo")
creation.set = "bar"
creation.name = "baz"
this will fail to compile.
What is the expected behavior?
We should catch problematic names at deploy (or even at codegen/build time) in graph-cli and graph-node.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
La issue indica graph-cli e graph-node come punti di ingresso per la validazione; inizia tracciando dove vengono verificati gli schemi dei subgraph durante il deploy o la generazione del codice. Riproduci lo schema e l’handler forniti, quindi assicurati che i nomi riservati come set, unset e i nomi di entità o campi con un underscore iniziale vengano rifiutati prima del deploy o della build.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- graphql, rust
- Ambito
- backend-api-design, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100