Predefined JsonAPI predefined data_path expressions exclude data

Created on 14 February 2025, about 2 months ago

Problem/Motivation

The JsonAPI Storage Client pre_defineds data selectors which exclude some data:

...
      'data_path' => [
        '#type' => NULL,
        'list' => [
          '#type' => 'hidden',
          '#default_value' => '$.data.*',
        ],
        'single' => [
          '#type' => 'hidden',
          '#default_value' => '$[data,included].0',
        ],
....
  1. List: Excludes the data from the include portion.
    And as far as I can tell list handling is also used to load single items. \Drupal\external_entities\DataAggregator\DataAggregatorBase::load() internally uses loadMultiple()
  2. Single: Only loads the _first_ include and ignores the others.

Steps to reproduce

Proposed resolution

Use $[data,included].* for both.
If used with a single type query there should be only one data item anyways - so no harm.
If used with a list we want the includes - unless there's some kind of internal listing which only is supposed to fetch ids. But then we'd have to seen how / when that list handling is used.

Remaining tasks

  1. Write Code
  2. Review
  3. Merge

User interface changes

None

API changes

Kinda, existing JsonPath queries might yield different output.

Data model changes

None

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇭Switzerland das-peter

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024