spring-projects / spring-projects/spring-data-rest

Entity Id (and version) is serialized from rest controller after upgrade to spring boot 2.3.3 [DATAREST-1558]

Open
#1,920 1 comment 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

arongas opened DATAREST-1558 and commented

 

I was using Spring boot springBootVersion = '2.1.9.RELEASE' and need at a project to migrate to springBootVersion = '2.3.3.RELEASE'. In this project we use spring data rest and also have some controllers returning database entities as EntityModel/Resource.

Before the upgrade what is serialized from the controller (and returned as as Resource) does not contain the entity id or the entity version. Similar to spring data rest interface. 

After upgrade, spring data rest interface continues to not return the id or the version, which is correct/expected but in the controller, the EntityModel<MyDBEntity> is serialized/returned along with the id/version json properties. I could not find the reason or any reference of it in trhe documentation. Is this a bug or is intended? Can this becaviour somehow be adapted vis project configuration to remain as it was with spring boot 2.1.9.RELEASE?

 

I have create a sample/small project with 2 unit tests. 

In commit Sample project with Spling boot 2.1.9,  the id and version in both controller and spring data rest are not exposed and both unit test com.example.demo.DemoApplicationTests#payloads and com.example.demo.DemoApplicationTests#dataRestPayloads pass.

In commit Spring boot 2.3.3, the unit test com.example.demo.DemoApplicationTests#payloads fails because id appears in the json body of the response.

 

If this is not the correct place for tracking this issue, please guide me accordingly.

 


Affects: 3.3.3 (Neumann SR3)

Reference URL: https://github.com/arongas/payload

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.