Skip to content

Adding an excerpt projection to a repository confusingly forces its entities to be embedded in other responses [DATAREST-1350] #1713

Open
@spring-projects-issues

Description

@spring-projects-issues

magneticflux- opened DATAREST-1350 and commented

This isn't mentioned explicitly in documentation anywhere that I found. In RepositoryRestResource::excerptProjection related resources are mentioned, but it isn't clear under what conditions related resources are inlined or where they will be inlined.

Expected behavior:
Creating a excerpt projection for a RestRepository for Entity A alters the response to that repository endpoint, but not responses from the repository for Entity B, where B contains links to A.

Actual behavior:
All references to Entity A inside Entity B are embedded, regardless if they embedded before creating an excerpt for A. This can cause an N^2 size explosion if there are many of Entity B that have many of Entity A related to them.

Thoughts:
It seems like there should be finer-grained control over what gets embedded and what gets linked. Perhaps an annotation for specifying what fields/collections are embedded or not instead of the logic inside EmbeddedResourcesAssembler?


Affects: 3.1.5 (Lovelace SR5)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions