Skip to content

Preserve DataFetcherResult extensions on subscription events - #4476

Open
kalayciburak wants to merge 1 commit into
graphql-java:masterfrom
kalayciburak:fix-4475-subscription-event-extensions
Open

kalayciburak wants to merge 1 commit into
graphql-java:masterfrom
kalayciburak:fix-4475-subscription-event-extensions

Conversation

@kalayciburak

Copy link
Copy Markdown

Summary

Fixes #4475.

When a subscription publisher emits a DataFetcherResult that carries extensions, those values never appear on the corresponding event ExecutionResult. unboxPossibleDataFetcherResult records them on the shared ExtensionsBuilder, but executeSubscriptionEvent builds each event result with only data and errors, and wrapWithRootFieldName then reconstructs the result without copying extensions.

Query execution already merges ExtensionsBuilder into the overall result. Subscription events are independent results, so the extensions from that event's DataFetcherResult need to travel with that event.

Change

  • Capture DataFetcherResult.getExtensions() from the event payload.
  • Pass them into the event ExecutionResultImpl.
  • Preserve extensions when wrapping the payload under the root field name.

Test plan

Executed locally:

  • RED: ./gradlew test --tests graphql.execution.SubscriptionExecutionStrategyTest — 24 tests, 1 failed (extensions=null on the new test)
  • GREEN: same class — 24/0
  • ./gradlew test --tests graphql.execution.DataFetcherResultTest --tests graphql.extensions.ExtensionsBuilderTest — 36/0

Copy extensions from an emitted DataFetcherResult onto that event's
ExecutionResult instead of dropping them when wrapping the root field.

Fixes graphql-java#4475

@bbakerman bbakerman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 0 (-5940 🔴) 0 (-5884 🔴) 0 (±0) 0 (±0) 0 (-56)
Java 17 0 (-5940 🔴) 0 (-5883 🔴) 0 (±0) 0 (±0) 0 (-57)
Java 21 0 (-5940 🔴) 0 (-5883 🔴) 0 (±0) 0 (±0) 0 (-57)
Java 25 0 (-5940 🔴) 0 (-5883 🔴) 0 (±0) 0 (±0) 0 (-57)
jcstress 32 (±0) 7 (-25 🔴) 0 (±0) 0 (±0) 0 (±0)
Total 32 (-23760 🔴) 7 (-23558 🔴) 0 (±0) 0 (±0) 0 (-227)

Updated: 2026-09-22 05:43:16 UTC

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subscription event DataFetcherResult.extensions are missing from emitted ExecutionResult

2 participants