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
- Select a resource in the JSON API extra configuration (/admin/config/services/jsonapi/resource_types)
- Override a resource and include a field in the "Default include list"
- Save the resource
- Access the JSON API path and verify the response (GET request)
- Verify the initial response would be the overwritten resource with complete data
- Access the API again and it will show the default state of the resource
Comments
Comment #2
ptmkenny commentedI 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.
Comment #3
lawxen commentedI 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');Comment #4
ptmkenny commented@lawxen Could you please share the Drupal and module versions you used to reproduce this?
Comment #5
lawxen commented@ptmkenny Drupal10.3.10 + "drupal/jsonapi_extras": "3.26.0" + drupal/jsonapi_include:1.8.0
Comment #6
ptmkenny commentedI'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.