- Issue created by @Anybody
In larger Drupal projects with many entities and entity types it becomes more and more unlikely that you want to expose all existing resources, so the Disabled by default ("If activated, all resource types that don't have a matching enabled resource config will be disabled.") is very helpful.
But as I had to find out after confusion, this also has the effect that referenced entities data (values) is no more directly exposable by using includes or field enhancers. They just don't return results any more. Also https://www.drupal.org/project/jsonapi_include → doesn't provide any data.
You have a node type with a media image referenced and simply want to retrieve the image uri and the image alt text via API, just like other field values from this entity type, e.g. expected result (see the field_image example, which is node > media > file > data)
"attributes": {
"drupal_internal__nid": 298662,
"drupal_internal__vid": 306330,
"langcode": "de",
"status": true,
"title": "My example content with a media image field",
"created": "2024-03-27T14:11:04+00:00",
"changed": "2024-03-27T14:11:04+00:00",
"field_image": {
"uri": "xyz",
"alt": "Lorem ipsum"
}, [...]
I think the field enhancer, if selected, could just ignore the disabled status of the reference target, while allowing to use it as include should definitely be a checkbox option to opt-into.
To have at least one of these options to access the reference data without the need to enable all these target resources for the client would be super helpful!
[ ] Discuss
[ ] Implement
[ ] Test
[ ] Release
Active
3.0
Code