graphql-python / graphql-python/graphql-core-legacy
List types are not correctly validated
- 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
Research direction
Start with the reported test case in test_list_literal_validation and trace validation from graphql.language.parser.parse through graphql.validation.validate, including the directive schema built by build_ast_schema. Run the example and confirm that passing a string to the required list argument produces validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100