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

List types are not correctly validated

未关闭
#97 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
372
派生
175
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 test_list_literal_validation 中报告的测试用例开始,跟踪从 graphql.language.parser.parse 到 graphql.validation.validate 的验证流程,包括由 build_ast_schema 构建的指令模式。运行示例并确认,将字符串传递给必需的列表参数会产生验证错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。