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

List types are not correctly validated

Offen
#97 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
372
Forks
175
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.