Problem/Motivation

The title for document schemas concerning multiple resource types duplicates the title of the last resource type instead of showing all the resource type titles.

Steps to reproduce

Navigate to the JSON:API schema endpoint for a relationship having multiple possible entity/bundles that could be related. In farmOS that looks like `/api/asset/animal/resource/relationships/location/related/schema` but this should be reproducible on any Drupal install where there is a relationship which isn't constrained to a single bundle - and where multiple bundles for the related entity type exist.

Proposed resolution

Fix the array slice.

Remaining tasks

Review/Test patch

User interface changes

N/A

API changes

Text of schema document title changes.

Data model changes

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Symbioquine created an issue. See original summary.

symbioquine’s picture

StatusFileSize
new697 bytes
m.stenta’s picture

Status: Active » Needs work

Confirmed this issue. It happens when there are greater than 2 allowed bundles in an entity reference field.

I created Page, Blog, and Article node types, and added an entity reference field to Articles called test_entity_reference that allows referencing any of them. The expected title on /api/node/article/resource/relationships/test_entity_reference/related/schema should be Article content item, Blog content item, and Page content item, but instead it is Page content item, and Page content item.

I will open a MR with a test for this and @symbioquine's fix.

m.stenta’s picture

Status: Needs work » Needs review
m.stenta’s picture

Status: Needs review » Reviewed & tested by the community

  • m.stenta committed ad37b984 on 8.x-1.x
    Issue #3322227 by symbioquine, m.stenta: Document schema title wrong for...
m.stenta’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.