Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
jsonapi.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Apr 2018 at 10:14 UTC
Updated:
3 Apr 2020 at 21:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lawxen commentedComment #3
lawxen commentedI have find dozens of jsonapi endpoint has this problem, so set it as critical
Comment #4
lawxen commentedAbove img show the key part debug information.
Maybe we shouldn't make fieldResolver return roles.entity.uuid, go to sleep :)
Comment #5
wim leersThis does not meet the definition of critical. I agree it's a very very important bug though!
Comment #6
lawxen commentedI simplify this issue by using the following code:
The jsonapi endpoint equal to executing above code, and the same error occurs.
I'm wondering whether it's a core bug?
@Wim Leers Do you have any idea?
Comment #7
wim leersQuoting
\Drupal\Core\Entity\Query\QueryInterface::condition()'s docs:… it doesn't say this, but AFAIK the
%field.entity.%field_on_that_referenced_enittyonly works for entities that have the same storage back-end. Content entities are stored in the database by default, config entities are not. So this could never work.Comment #8
wim leersIOW: core's configuration entity system does not support this, so neither can JSON API. The entity query system in core should do better checking around this and provide a more informative exception though!
Comment #9
wim leersI was going to suggest something like
is_subclass_of($this->resourceType->getDeserializationTargetClass(), ConfigEntityInterface::class);… but that only works if you're querying a config entity type directly!Anyway, let's not wait for core to get its act together, we can improve DX today.
Comment #10
wim leersFailing test.
Comment #11
wim leersAnd fix.
Comment #12
wim leersComment #14
gabesulliceNice improvement. LGTM.
Comment #16
wim leersComment #17
e0ipso👏🏽
Comment #19
rpayanmMoving to Drupal core's issue queue.
I'm working on https://www.drupal.org/project/drupal/issues/3122113