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

Fowler SR2 breaks Fowler SR1 with deviation in auto generated JSON structure [DATAREST-629]

Open
#993 5 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

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

Description

Rakesh opened DATAREST-629 and commented

Hi,

Upto Fowler-SR1 release, when I hit a Spring Data REST repository, I used to get the below structure as output

{
  "links" : [ {
    "rel" : "search",
    "href" : "http://localhost/spring/ProductStatus/search"
  } ],
  "content" : [ {
    "productStatusCode" : "AVL",
    "productStatusDesc" : "Available",
    "isInactive" : false,
    "links" : [ ],
    "content" : [ ],
    "links" : [ {
      "rel" : "self",
      "href" : "http://localhost/spring/ProductStatus/AVL"
    } ]
  }, {
    "productStatusCode" : "DEA",
    "productStatusDesc" : "Retired",
    "isInactive" : false,
    "links" : [ ],
    "content" : [ ],
    "links" : [ {
      "rel" : "self",
      "href" : "http://localhost/spring/ProductStatus/DEA"
    } ]
  } ]
}

After I upgrading to Fowler-SR2, the output I get, without any changes to the underlying JPA entity/Repository configuration is as below

{
  "_links" : {
    "search" : {
      "href" : "http://localhost/spring/ProductStatus/search"
    }
  },
  "_embedded" : {
    "ProductStatus" : [ {
      "productStatusCode" : "AVL",
      "productStatusDesc" : "Available",
      "isInactive" : false,
      "_links" : {
        "self" : {
          "href" : "http://localhost/spring/ProductStatus/AVL"
        }
      }
    }, {
      "productStatusCode" : "DEA",
      "productStatusDesc" : "Retired",
      "isInactive" : false,
      "_links" : {
        "self" : {
          "href" : "http://localhost/spring/ProductStatus/DEA"
        }
      }
    }]
  }
}

This is causing all my client code to break!


Affects: 2.3.2 (Fowler SR2)

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.