Skip to content

Support interface projections for annotated controller return values - #1518

Open
goutamadwant wants to merge 1 commit into
spring-projects:mainfrom
goutamadwant:controller-return-projections
Open

Support interface projections for annotated controller return values#1518
goutamadwant wants to merge 1 commit into
spring-projects:mainfrom
goutamadwant:controller-return-projections

Conversation

@goutamadwant

Copy link
Copy Markdown

Annotated controllers currently require manual projection creation to expose a view of a domain object. Add @ProjectAS to select a Spring Data interface projection for a @schemamapping method, including query, mutation, and subscription mappings.

Apply projections to returned values and collection or asynchronous elements while preserving nulls, errors, and DataFetcherResult metadata. Include projected return-type information for schema inspection, nested projection proxy hints for AOT, and reference documentation. Spring Data Commons remains optional for controllers without the annotation.

Tests cover synchronous and asynchronous results, subscriptions, coroutine controllers, exception handling, projected child sources, invalid targets, and inherited/composed AOT projections.

Validation: the final controller, coroutine, and AOT suites pass (65 tests), together with fresh style and architecture checks. Broader default and Java 21 suites, run before the final two metadata corrections, had the same 10 existing MVC/WebFlux SSE whitespace assertion failures reproduced on unmodified main, plus 3 pre-existing skips.

Closes #657.

Add ProjectAs for annotated controller return values, reusing Spring Data
interface projections and preserving collection and asynchronous shapes.
Include schema inspection metadata and nested projection AOT hints.

Closes spring-projects#657.

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.

Support Spring Data projections as @SchemaMapping method return values

2 participants