api-platform / api-platform/core

Add @type or @context (or both) properties to Mercure data when object is deleted

Đang mở
#8,062 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
2.6k
Fork
980
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
49

Mô tả

**Description**
Currently, the data of the Mercure update contains only the IRI of the removed object inside the `@id` property. This is enough for cases where topics are created for specific collections or items. More generic topics containing updates for several collections force the subscriber to parse the IRI to identify the affected collection. Unfortunately, for some collections, this requires writing a code which is difficult to maintain. An example of such an issue would be a collection of `Person` entities. The prefix for such entities is `/people/`. Adding the `@type` in the case of update/create events would make it easier for the subscriber to identify the affected collection.

**Example**
The `data` of the event would change from:
```
{"@id":"\/people\/1ed69b32-4697-68fc-9f20-e17dcbef2976"}
```
to:
```
{"@type":"Person", "@id":"\/people\/1ed69b32-4697-68fc-9f20-e17dcbef2976"}
```

I can create a PR if this is accepted.

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.