Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Depth limit validator key error if fragment undefined

オープン
#1,538 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

@Hassad674 がすでに取り組んでいます。

2026年3月19日 から。

  • #1603 @Hassad674 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
graphql, python

調査の方向性

graphene/validation/depth_limit.py の148行目付近を調べ、次に GraphQLView に depth_limit_validator を設定した状態で、未定義のフラグメントを含むクエリを再現します。このケースで、KeyError や 500 エラーではなく、未知のフラグメントに対する標準のバリデーションレスポンスが生成されることを確認してください。

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

説明

🐛 bug

Current behaviour:
When using the depth_limit_validator (docs), an invalid query can lead to a KeyError being thrown (from here), which usually results in the API returning a 500 server error.

To reproduce:

  • Add the depth_limit_validator to the validation_rules in your GraphQLView.
  • Execute a query with an undefined fragment, i.e. something like:
query {
  validQuery {
    validField
    ...undefinedFragment
  }
}

Expected behaviour:
A standard validation error response, like:

{
  "errors": [
    {
      "message": "Unknown fragment 'undefinedFragment'.",
      "locations": [
        {
          "line": x,
          "column": y
        }
      ]
    }
  ]
}

Since this is something that's caught by the standard validators, depth_limit_validator should probably just skip such errors. Or, do whatever the other validators do when they hit an "unrelated" error.

Environment:

  • Version: 3.3
  • Platform: n/a
主要言語
Python
スター
8.2k
フォーク
822
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphql-python/graphene のほかの issue

graphql-python/graphene の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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