api-platform / api-platform/core

HAL links of embedded resources not consistent with standard representation

未關閉
#1,291 18 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Good First Issue Hacktoberfest
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 5 小時
30 天內合併 PR
48

描述

Considering using the demo app: https://github.com/api-platform/demo

Modifying the `Book` Entity so `Reviews` are embedded.
A review looks like:
```json
{
"_links": {
"book": {
"href": "/books/3"
},
"self": {
"href": "/reviews/275"
}
},
"author": "Herbert Reinger I",
"body": "Voluptas hic ipsum cumque aliquid. Vero iusto sit atque hic non voluptate dignissimos velit. In reprehenderit accusamus cum porro. Doloremque eligendi architecto quia omnis eaque vel officiis.",
"id": 275,
"publicationDate": "1970-07-11T14:10:52+00:00",
"rating": 5
}
```

A book (with embedded review) looks like this:
```
{
"_embedded": {
"reviews": [
{
"_links": {
"self": {
"href": "/reviews/275"
}
},
"author": "Herbert Reinger I",
"body": "Voluptas hic ipsum cumque aliquid. Vero iusto sit atque hic non voluptate dignissimos velit. In reprehenderit accusamus cum porro. Doloremque eligendi architecto quia omnis eaque vel officiis.",
"id": 275,
"publicationDate": "1970-07-11T14:10:52+00:00",
"rating": 5
}
]
},
"_links": {
"reviews": [
{
"href": "/reviews/275"
}
],
"self": {
"href": "/books/3"
}
},
"author": "Prof. Joelle Doyle",
"description": "Cupiditate quae ut sit illo. Accusamus ex voluptatem et eveniet nemo voluptatibus necessitatibus. Veniam odit ducimus consequuntur voluptatem id quod pariatur distinctio.",
"id": 3,
"isbn": "9783899289190",
"publicationDate": "1996-01-02T00:00:00+00:00",
"title": "Excepturi quo dolor et officiis minima et consequatur earum."
}
```

Note that the embedded `Review` does not have a `book` in its `_links`.
How can the embedded representation be made to match the non embedded?
I.e they both should have `book` link. the representation must be consistent.

Thanks

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。