Problem/Motivation

The initial request to a JSON API resource that is overwritten shows full response (complete data) but consecutive request will show the default state of the API resource... also, when updating a content in the CMS, this response sequence will repeat again which is odd

This is a problem because the website is using the included field as a dependency especially for getting the initial data. for the user

Steps to reproduce

  1. Select a resource in the JSON API extra configuration (/admin/config/services/jsonapi/resource_types)
  2. Override a resource and include a field in the "Default include list"
  3. Save the resource
  4. Access the JSON API path and verify the response (GET request)
  5. Verify the initial response would be the overwritten resource with complete data
  6. Access the API again and it will show the default state of the resource

Comments

eugene.masangkay created an issue. See original summary.

ptmkenny’s picture

Version: 8.x-3.26 » 8.x-3.x-dev
Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

I could not reproduce this based on your steps to reproduce. Please provide more specific steps about how to reproduce this issue from a clean install of Drupal 10/11.

Also, please file bug reports after testing against the dev branch of the module (3.x-dev), just in case the bug has already been fixed in dev but is not yet released.

lawxen’s picture

I can reproduced the problem with jsonapi_include enabled.

The jsonapi_inclue can't get the parameter on second request.
https://git.drupalcode.org/project/jsonapi_include/-/blob/8.x-1.x/src/Js...
$include_parameter = $this->requestStack->getCurrentRequest()->query->get('include');

ptmkenny’s picture

Assigned: eugene.masangkay » Unassigned
Status: Postponed (maintainer needs more info) » Active

@lawxen Could you please share the Drupal and module versions you used to reproduce this?

lawxen’s picture

@ptmkenny Drupal10.3.10 + "drupal/jsonapi_extras": "3.26.0" + drupal/jsonapi_include:1.8.0

ptmkenny’s picture

Priority: Normal » Major

I'm elevating this to major because this issue is breaking the JSON:API Include module; see #3490592: Incompatible with jsonapi_default.

There are multiple people in that issue trying to find a workaround for an issue that seems to be caused by the JSON:API Defaults submodule.