api-platform / api-platform/core

HAL links of embedded resources not consistent with standard representation

Đang mở
#1,291 18 bình luận 0 reaction 0 người được giao Xem trên GitHub
Good First Issue Hacktoberfest
Ngôn ngữ chính
PHP
Star
2.6k
Fork
980
Merge trung bình
2 ngày 5 giờ
Pull request đã merge (30 ngày)
48

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.