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

Order of Middlewares

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

説明

I've discovered that this line inverts the middleware order:
https://github.com/graphql-python/graphql-core/blob/6df8a6312b579a6a1454bcf29a566ce5d0fa9849/graphql/execution/middleware.py#L51

This was somewhat confusing, as I expected the first installed middleware to be the entrypoint. I.e.

```python
schema.execute(
statement,
middleware=[mw1, mw2],
)
```

actually produces the call stack `mw2 -> mw1 -> resolve_func`, whereas i'd expected `mw1 -> mw2 -> resolve_func`.

I'm not clear if this is a bug, as this functionality isn't tested anywhere, or if it would just go in documentation somewhere.

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

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

調査の方向性

graphql/execution/middleware.py#L51 から始め、middleware=[mw1, mw2] の例を使って schema.execute で呼び出し順序を再現します。既存の実行テストで middleware のカバレッジを確認します。完了とは、意図した順序が確定し、回帰テストまたはドキュメントに記録されていることを意味します。

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

評価

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

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

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