Error: Call to a member function getTypeName() with jsonapi tags and user resources
tormi opened this issue · 6 comments
/docroot/jsonapi/taxonomy_term/tags
and /docroot/jsonapi/user/user
gives an error Call to a member function getTypeName() ...
I've noticed this too. It's a bug in https://www.drupal.org/project/jsonapi AFAICT. I'll try to figure out the root cause and report it at https://www.drupal.org/project/issues/jsonapi.
It looks like listing users where a user is granted a custom user role breaks. The $this->resource
attribute in the RelationshipItemNormalizerValue
is set to null in this case.
Hey guys,
It looks like the following line is causing the problem.
If you comment out that line, you'll find that the taxonomy endpoint works again.
Regards,
Thai
@snufkin Thanks for that more detailed report!
@thaiphan Thanks for pointing out a work-around.
You're right that https://github.com/acquia/reservoir/blob/1.0.0-alpha2/modules/reservoir_ui/src/ReservoirResourceTypeRepository.php#L48 is blacklisting both the user_role
and taxonomy_vocabulary
config entity types. Reservoir has good reasons to do this (see the accompanying code docs). Reservoir is merely implementing logic similar to https://www.drupal.org/project/jsonapi_extras. So if this doesn't work in Reservoir UI, it also can't work there. Unless https://www.drupal.org/project/jsonapi_extras has been modified since https://www.drupal.org/project/jsonapi_extras was written.
I will investigate this.
In any case, confirming this to be an upstream bug, or at the very least an upstream API change.