Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded resources default serialisation with projector [DATAREST-1435] #1795

Closed
spring-projects-issues opened this issue Oct 4, 2019 · 3 comments
Assignees
Labels

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 4, 2019

genglefr opened DATAREST-1435 and commented

When serializing a LAZY loadable embedded resource, there should be a way to configure that LAZY value should not be serialized.

For instance, when a @OneToMany association is considered, and the database call not triggered yet, the EmbeddedResourcesAssembler checks for a ExcerptProjection on the property, which will never be null as LAZY is not considered null:

EmbeddedResourcesAssembler:74

if (!projector.hasExcerptProjection(property.getActualType()))

{ return; }

DefaultExcerptProjector:67

return metadata == null ? false : metadata.getExcerptProjection() != null;

 

This causes the resolution of the LAZY property.

A potential bugfix could be:

DefaultExcerptProjector:64

@Override
public boolean hasExcerptProjection(Class<?> type) {
   ResourceMetadata metadata = mappings.getMetadataFor(type);
   return metadata == null ? false : metadata.getExcerptProjection() != null && metadata.getExcerptProjection().isPresent();
}

Affects: 3.2 GA (Moore)

Issue Links:

  • DATAREST-1446 DefaultExcerptProjector exposes projection present even if metadata returns Optional.empty()
    ("duplicates")

Backported to: 3.2.1 (Moore SR1)

1 votes, 2 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 17, 2019

genglefr commented

Any update on this please?

It prevents me from updating to spring boot 2.2

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 30, 2019

Oliver Drotbohm commented

Looks like this is a duplicate of DATAREST-1446, which we had fixed a couple of days ago. Any chance you give the snapshots a try before the service release upcoming early next week?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 7, 2019

genglefr commented

I confirm the issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants