We have a taxonomy vocabulary "theme" with a paragraph reference field ''field_content_blocks". One of the referenced paragraphs has "field_teaser_content" as a field. We've been using the following call prior to 8.x-1.2:

/jsonapi/taxonomy_term/theme/1ae8f61c-2f81-43d7-b141-93981418eeb1/field_content_blocks?include=field_teaser_content

By fixing "JSON API Extras overrides not implemented for include properties (2879860)", the includes are now ran through FieldResolver. This class also checks if the includes are part of requested entity type. In our case it checks if "field_teaser_content" is a field connected to entity type 'taxonomy_term' instead of 'paragraph'.

Snippet from FieldResolver.php:

    $entity_type_id = $this->currentContext->getResourceType()->getEntityTypeId();
    $reference_breadcrumbs = [];
    $resource_types = [$resource_type];
    while ($field_name = array_shift($parts)) {
      $field_name = $this->getInternalName($field_name, $resource_types);
      if (!$definitions = $this->fieldManager->getFieldStorageDefinitions($entity_type_id)) {
        throw new BadRequestHttpException(sprintf(
          'Invalid nested filtering. There is no entity type "%s".',
          $entity_type_id
        ));
      }
      if (empty($definitions[$field_name])) {
        throw new BadRequestHttpException(sprintf(
          'Invalid nested filtering. Invalid entity reference "%s".',
          $field_name
        ));
      }

The part below returns "taxonomy_term"

$entity_type_id = $this->currentContext->getResourceType()->getEntityTypeId();

so the $definitions doesn't contain our paragraphs field

$definitions = $this->fieldManager->getFieldStorageDefinitions($entity_type_id)

to the error is trigged

 if (empty($definitions[$field_name])) {
        throw new BadRequestHttpException(sprintf(
          'Invalid nested filtering. Invalid entity reference "%s".',
          $field_name
        ));
      }

Comments

harrrrrrr created an issue. See original summary.

harrrrrrr’s picture

Status: Active » Closed (outdated)