graphql-python / graphql-python/graphql-core-legacy

List types are not correctly validated

Aperta
#97 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
372
Fork
175
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.