json-server icon indicating copy to clipboard operation
json-server copied to clipboard

_expand option is not working at 1.0.0-beta.3

Open rommelcarneiro opened this issue 5 months ago • 0 comments

Hi folks, in 1.0.0-beta.3 version the _expand option to see related data is not working. Even after changing all the ids to string in the db.json file as informed in the release notes to this version.

I'm using jsonplaceholder's data (posts, comments, photos, albums and users entities).

Trying to request http://localhost:3000/comments/1?_expand=post, returns just the following data:

{
  "postId": "1",
  "id": "1",
  "name": "id labore ex et quam laborum",
  "email": "[email protected]",
  "body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
}

Back to the 0.17.0 version, the result is correct, as follows.

{
  "postId": "1",
  "id": "1",
  "name": "id labore ex et quam laborum",
  "email": "[email protected]",
  "body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium",
  "post": {
    "userId": "1",
    "id": "1",
    "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
    "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
  }
}

rommelcarneiro avatar May 08 '25 13:05 rommelcarneiro