graphql-python / graphql-python/graphene

When sending multiple invalid values, response errors only contains the first failure

オープン
#1,164 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
🐛 bug
主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

説明

using graphene-2.1.8
When passing query data to the below query
we only get one error when two are expected
```
class SubscriptionPlanObjects(graphene.ObjectType):
subscription_plan_objects = graphene.List(
graphene.NonNull(graphql.SubscriptionPlanObject),
subscriber_id=graphene.Int(required=True),
subscriber_type=graphene.String(required=True),
target_currency=graphene.String(required=True),
)

def resolve_subscription_plan_objects(
self, info, subscriber_id, subscriber_type, target_currency
):
pass

query = """
query subscriptionPlanObjects ($subscriberId: Int!, $subscriberType: String!, $targetCurrency: String!) {
subscriptionPlanObjects (subscriberId: $subscriberId, subscriberType: $subscriberType, targetCurrency: $targetCurrency) {
id
}
}
"""
test_schema = build_schema(query=SubscriptionPlanObjects)
gql_client = Client(test_schema)
response = gql_client.execute(self.query, variables=kwargs)
```
data like:
```
kwargs = {
"subscriberId": None,
"subscriberType": 3,
"targetCurrency": "usd"
}
```
We only get the one error, response["errors"] is
```
[
{
'locations': [{'column': 40, 'line': 2}],
'message': 'Variable "$subscriberId" of required type "Int!" was not provided.'
}
]
```
When we should also get an error on the subscriberType argument because it is not type String!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

提供されているエントリポイント build_schema と Client.execute から始め、複数の値が無効な場合にクエリ変数がどのように強制変換され、報告されるかを追跡します。subscriberId を None に、subscriberType を 3 に設定した例を再現します。response["errors"] に両方の検証エラーが含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。