graphprotocol / graphprotocol/graph-node
Stricter subgraph schema validation
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Rust
- Estrellas
- 3.2k
- Forks
- 1.1k
- Merge medio
- 4 d 1 h
- PR fusionados (30 d)
- 1
Descripción
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.
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.
Línea de trabajo
El issue nombra graph-cli y graph-node como puntos de entrada de la validación; empieza por rastrear dónde se comprueban los esquemas de subgraph durante el despliegue o la generación de código. Reproduce el esquema y el handler proporcionados, y asegúrate después de que los nombres reservados como set, unset y los nombres de entidades o campos con guion bajo inicial se rechacen antes del despliegue o la compilación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- graphql, rust
- Área
- backend-api-design, tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100