graphql-python / graphql-python/graphql-core-legacy
List types are not correctly validated
- Lenguaje dominante
- Python
- Estrellas
- 372
- Forks
- 175
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Consider the following test case:
```
from graphql.language.parser import parse
from graphql.utils.build_ast_schema import build_ast_schema
from graphql.validation import validate
def test_list_literal_validation():
schema_text = '''
schema {
query: RootSchemaQuery
}
directive @foo(list: [String!]!) on FIELD | INLINE_FRAGMENT
type Bar {
name: String
}
type RootSchemaQuery {
Bar: Bar
}
'''
schema = build_ast_schema(parse(schema_text))
query = '''
query Baz {
Bar {
name @foo(list: "not_a_list")
}
}
'''
query_ast = parse(query)
errors = validate(schema, query_ast)
assert errors
```
Note that the directive `@foo` requires a list argument, but is passed a string argument instead. Despite this problem, this library claims that the GraphQL query validates with no errors, failing the test. I believe this to be a bug.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza con el caso de prueba reportado en test_list_literal_validation y sigue la validación desde graphql.language.parser.parse hasta graphql.validation.validate, incluido el esquema de directivas creado por build_ast_schema. Ejecuta el ejemplo y confirma que pasar una cadena al argumento de lista requerido produce errores de validación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100