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
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

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.

ptmkenny’s picture

Status: Active » Needs review

I used Claude Opus 4.8 to analyze this, generate a fix, and provide a test. This bug is breaking JSON:API Include for some users, so it would be great if someone else who experienced the bug can confirm that this fixes the issue for them.

bbrala’s picture

Reviewed and makes sense. Thank you.

bbrala’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • bbrala committed 2a9f37ae on 8.x-3.x
    fix: #3487895 Initial request shows complete response on an included...

Status: Fixed » Closed (fixed)

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