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

List types are not correctly validated

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
372
Forks
175
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.