Include parameter doesn't work with different type of entities
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3172884. --> Reported by: [lisotton](https://www.drupal.org/user/1902738) Related to !31 !11 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When returning a list of entities that are not the same, or a list of nodes with different content-types, if the "include" parameters is used, it checks for the first entity if this field can be included and if not possible, it raises an error with message: </p> <pre>title: "Bad Request",<br>status: "400",<br>detail: "`article_category` is not a valid relationship field name. Possible values: node_type, revision_uid, uid, menu_link, category, content_paragraphs, featured_image, related_content, tags, useful_links.",</pre><p>An example of module that uses JSON:API Resources is <a href="https://www.drupal.org/project/jsonapi_search_api">JSON:API Search API</a>, which makes a lot of sense to return node within different content types.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>My suggestion is to receive the resource identifier as part of include path and check that before include it, something like ?include=node--article.article_category.</p> > Related issue: [Issue #3428278](https://www.drupal.org/node/3428278)
issue