Closed (works as designed)
Project:
JSON:API Node Preview
Version:
1.0.0-beta1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Mar 2022 at 08:15 UTC
Updated:
24 Apr 2022 at 06:21 UTC
Jump to comment: Most recent
Comments
Comment #2
elendev commentedI've found the issue: it's an access check linked to the fact that the permission `view all revisions` is only applied to node and media.
Line 198 - 199 of EntityAccessChecker.php: https://api.drupal.org/api/drupal/core%21modules%21jsonapi%21src%21Acces...
Bypassing this permission fixes this issue.
To bypass this permission, one can create a custom module and extend the EntityAccessChecker of JSONAPI:
And register it as a decorator service in my_module.services.yml:
Comment #3
albertosilvaHi @elendev:
I think you are trying to get a node preview from a non-default revision, passing also an
includeparameter to get that Paragraph. Using a non-default revision makes JSON:API callcheckRevisionViewAccess()with that Paragraph entity as an argument, making JSON:API throw an error.Using a node's default revision works as expected.
From my point of view, this is a problem/bug with JSON:API, where using a non-default revision for an entity enforces having to use that revision for all other included entities, even though they are not revisionable.
Thanks for sharing a solution for this problem, but there is nothing I can do as a module maintainer to fix it, since it is outside of the scope of JSON:API Node Preview.
Thanks!
Comment #4
albertosilva