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

Aperta Adatta ai principianti
#3,861 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 7 giorni

@hippi345 ci sta già lavorando.

Dal 17/10/2026.

  • #3862 di @hippi345 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, csharp, graphql
Ambito
api, databases

Direzione di ricerca

Inizia da src/Core/Resolvers/Sql Query Structures/SqlQueryStructure.cs e leggi AddGraphQLFields, concentrandoti su come i rami per la propagazione dei frammenti e per i frammenti inline gestiscono le selezioni rimanenti. Controlla i test GraphQL esistenti per le selezioni dei frammenti e aggiungi test per i campi che seguono entrambe le forme di frammento. Il lavoro è completo quando i campi scalari e di relazione che seguono un frammento sono inclusi nella query SQL e restituiti, mentre il comportamento esistente dei frammenti continua a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
1.5k
Fork
380
Merge medio
5g 45m
PR unite (30g)
6

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/data-api-builder

Tutte le issue di Azure/data-api-builder

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.