Skip to content

Resolve empty single-entity mappings as null - #1535

Open
goutamadwant wants to merge 1 commit into
spring-projects:mainfrom
goutamadwant:1516-null-missing-entities
Open

goutamadwant wants to merge 1 commit into
spring-projects:mainfrom
goutamadwant:1516-null-missing-entities

Conversation

@goutamadwant

Copy link
Copy Markdown

Summary

Single-entity @EntityMapping methods now return a null _entities element when they complete empty, matching the nullable Federation entity list and batch mapping behavior. An internal marker preserves its position while Mono.zip assembles the results; only the final result is converted to null. Resolver exceptions and empty batch results retain their existing errors.

Synchronous null single-entity results also resolve to null because they follow the same empty-publisher path as Mono.empty().

Tests

Added a mixed-result regression covering an empty Mono, successful entities, and a resolver exception. Updated the existing synchronous-null assertion; batch error tests remain unchanged.

  • ./gradlew :spring-graphql:checkstyleMain :spring-graphql:checkstyleTest :spring-graphql:test --tests 'org.springframework.graphql.data.federation.EntityMappingInvocationTests' --no-daemon
  • ./gradlew :spring-graphql:checkstyleMain :spring-graphql:test --no-daemon --max-workers=1

Fixes #1516.

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single-entity @EntityMapping should resolve an empty Mono to a null _Entity (per Federation spec) instead of raising a per-entity error

2 participants