[Bug]: GraphQL fields listed after a fragment spread are silently dropped

オープン 初心者向け
#3,861 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 7 日以内に返信

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

2026年10月17日 から。

  • #3862 @hippi345 による — オープン

評価

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

調査の方向性

src/Core/Resolvers/Sql Query Structures/SqlQueryStructure.csから始めてAddGraphQLFieldsを読み、フラグメントスプレッドとインラインフラグメントの各分岐が残りの選択をどのように処理するかに注目してください。フラグメント選択に関する既存のGraphQLテストを確認し、両方のフラグメント形式の後にあるフィールドのテストを追加してください。フラグメントの後にあるスカラーとリレーションシップのフィールドがSQLクエリに含まれて返され、既存のフラグメントの動作も引き続き機能することを完了条件とします。

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

説明

bug triage

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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

Azure/data-api-builder のほかの issue

Azure/data-api-builder の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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