- π·π΄Romania stefan.butura
Attached an attempt at creating a patch from MR 2417 that is compatible with Drupal 10.3.x
- π·π΄Romania stefan.butura
Attached an attempt at creating a patch from MR 2417 that is compatible with Drupal 10.3.x
At the moment JSON:API is not able to normalize a list of revisions of the same entity because of normalizations' cache. If you pass 10 revisions the normalized structure for all of them will be the same since the first result is cached and used because of matching cache tags, which are resource name
and entity ID
.
I understand that this functionality is not offered by JSON:API out of the box and to achieve this I wrote a custom code that relies on PHP API (the jsonapi.entity_resource
service in particular) even despite a warning that developers shouldn't do that.
Nevertheless, the solution to overcome this problem is simple and seems so logical so I don't think it should stay overboard.
Include a revision ID to the cache tags.
Every 403 error object (omission) receives two new members in the links.via.meta
node: resourceId
and resourceVersion
. The existing value at links.via.href
may include the resourceVersion
GET query parameter if a revision ID is known (entity is revisionable and has a revision).
Example:
{
"links": {
"via": {
"href": "https://example.com/node/12?resourceVersion=id%3A12",
"meta": {
"resourceId": "entity_uuid",
"resourceVersion": "12"
}
},
}
}
The resourceId
is always present and is a UUID of omitted entity. The resourceVersion
is always present and can be null
in the case when entity has no revision (Drupal\Core\Entity\RevisionableInterface::getRevisionId()
returns null
) or non-revisilable (the entity class does not implement the Drupal\Core\Entity\RevisionableInterface
). A result of getRevisionId()
otherwise.
Needs work
11.0 π₯
jsonapi.module
A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Attached an attempt at creating a patch from MR 2417 that is compatible with Drupal 10.3.x
Attached an attempt at creating a patch from MR 2417 that is compatible with Drupal 10.3.x