Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Drupal core made the class \Drupal\jsonapi\ResourceResponse not implement CacheableResponseInterface anymore. This introduces issues for the module in 9.1. The new class Drupal\jsonapi\CacheableResourceResponse can be used on Drupal >= 9.1.
Proposed resolution
Use the new class Drupal\jsonapi\CacheableResourceResponse if it exists but use \Drupal\jsonapi\ResourceResponse as a fallback to not force everyone to update to Drupal 9.1 immediately.
Comment | File | Size | Author |
---|---|---|---|
#11 | 3187549-11.patch | 2.03 KB | mglaman |
#5 | 3187549-5.patch | 1.54 KB | larowlan |
#5 | 3187549-5.interdiff.txt | 1.92 KB | larowlan |
#2 | jsonapi_resources-become-compatible-with-drupal-9-1-3187549-2.patch | 1.26 KB | auth |
Issue fork jsonapi_resources-3187549
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
Comment #2
auth CreditAttribution: auth commentedAttached patch implementing proposed resolution
Comment #3
marthinal CreditAttribution: marthinal at Bluespark commentedI found the same problem. I'm trying to understand if we need to refactor this. There is a Functional test testAddCommentResource() that executes a POST.
If I go to AddComment::process
We execute processEntityCreation() . If I go to that method I see this $response
I'm using commerce_api and we have different resources to update or add items and we always return createJsonapiResponse().
I think we can return CacheableResourceResponse if the method is cacheable
otherwise we can return ResourceResponse.
Comment #4
larowlanAdding the error message here for folks using duckduckgo etc
Comment #5
larowlanFixing coding standards
Comment #6
mglamanI want to get #3189198: Allow installation with Drupal 9 in quick, so we can test against 9.1
Comment #7
mglamanComment #8
mglaman🤦🏼♂️sorry, this module is OK not the module I was trying.
Comment #9
mglamanFixing D9 phpcs failures here: #3189204: Fix PHPCS, then re-running and merging.
Comment #10
mglamanCommitted the PHPCS fix and re-queued the test. Comitting once passed and tagging a release.
Comment #11
mglamanFixing deprecation. I don't know why 9.2 breaks, but 9.1 is good with this.
Comment #13
mglamanThank you all! Tagging a release.
Comment #14
larowlan🙏 merci beaucoup