[Bug]: GraphQL fields listed after a fragment spread are silently dropped
メンテナーはふだん 7 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
src/Core/Resolvers/Sql Query Structures/SqlQueryStructure.csから始めてAddGraphQLFieldsを読み、フラグメントスプレッドとインラインフラグメントの各分岐が残りの選択をどのように処理するかに注目してください。フラグメント選択に関する既存のGraphQLテストを確認し、両方のフラグメント形式の後にあるフィールドのテストを追加してください。フラグメントの後にあるスカラーとリレーションシップのフィールドがSQLクエリに含まれて返され、既存のフラグメントの動作も引き続き機能することを完了条件とします。
索引モデルが issue の本文から書いたものです。
説明
Note: The below was written and discovered by claude but I have independently verified it myself as well.
What happened?
When a selection set contains a fragment spread (or inline fragment), every field listed after it in the same selection set is never added to the SQL query. Those fields come back null with no error. This applies to both scalar fields and relationship fields.
Repro:
query {
book_by_pk(id: 1) {
...bookFields
title
publishers { name }
}
}
fragment bookFields on book { id }
Expected: id, title and publishers are populated.
Actual: id is populated; title and publishers are null.
The same query works if ...bookFields is moved to the end of the selection set, or removed.
Cause: in SqlQueryStructure.AddGraphQLFields, both the FragmentSpread and the InlineFragment branches recurse into the fragment and then return;. That exits the foreach over the remaining selections. These look like they should be continue;:
https://github.com/Azure/data-api-builder/blob/main/src/Core/Resolvers/Sql%20Query%20Structures/SqlQueryStructure.cs (the two return; statements after the recursive AddGraphQLFields calls)
The return; dates from #1236, which added fragment support for #1235. The Cosmos path (GenerateQueryColumns) iterates over every selection and isn't affected.
Version
2.1.5
What database are you using?
Azure SQL
What hosting model are you using?
Container Apps
Which API approach are you accessing DAB through?
GraphQL
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 380
- 平均マージ
- 5日 45分
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/data-api-builder のほかの issue
-
pgsql
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3598 ·
メンテナーはふだん 7 日以内に返信
-
2.x cli mcp-server
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3576 ·
メンテナーはふだん 7 日以内に返信
-
2.x health-endpoint
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3570 ·
メンテナーはふだん 7 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3564 ·
メンテナーはふだん 7 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/data-api-builder#3562 ·
メンテナーはふだん 7 日以内に返信
Azure/data-api-builder の issue をすべて見る
似ている issue
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 2 日以内に返信
-
bug github_actions
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
endercodezz/BYDLO#336 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
SubtitleEdit/subtitleedit#16638 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
sebastienros/jint#4449 ·
メンテナーはふだん 1 日以内に返信