api-platform / api-platform/core

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

Abierto
#8,062 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 4 h
PR fusionados (30 d)
49

Descripción

**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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.