JSON:API include parser should be disabled by default (V1.7)

Created on 1 December 2023, over 1 year ago
Updated 28 August 2024, 7 months ago

Problem/Motivation

The jsonapi_include parser is by default enabled in src/EventSubscriber/ResponseSubscriber.php onResponse method:

...
      $need_parse = TRUE; // Here: is default to TRUE.
      if ($this->config->get('jsonapi_include.settings')->get('use_include_query')) {
        $need_parse = !empty($event->getRequest()->query->get('jsonapi_include'));
      }

      if ($need_parse) {
...

And that policy is breaking jsonapi response when the module is enabled but the use_include_query config is not enabled, the module is working well when use_include_query config is enabled.

Steps to reproduce

Enable the module without enabling use_include_query on module configuration form.

Proposed resolution

By default set $need_parse to FALSE like so:

...
      $need_parse = FALSE;
      if ($this->config->get('jsonapi_include.settings')->get('use_include_query')) {
        $need_parse = !empty($event->getRequest()->query->get('jsonapi_include'));
      }

      if ($need_parse) {
...
📌 Task
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇲🇦Morocco b.khouy 🇲🇦 Morocco

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