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
Disabled resources are still accessible via the related, relationship and includes. They should not be available if they are disabled, even if that breaks the full linkage principle.
Proposed resolution
Use the resource type repository to determine if a referenced resource is available or not.
Comment | File | Size | Author |
---|---|---|---|
#13 | 2933615--interdiff--10-13.txt | 3.16 KB | e0ipso |
#13 | 2933615--fix-related-relationship-disabled--13.patch | 4.18 KB | e0ipso |
|
Comments
Comment #2
e0ipsoInitial patch.
Comment #4
e0ipsoComment #5
e0ipsoComment #6
e0ipsoComment #7
e0ipsoMerging to unblock testing PR for JSON API Extras.
Comment #9
gabesulliceMaybe we should catch and wrap this exception? That would allow us to provide more context about the error in our response.
Nit: missing spaces
Perhaps we should find a way to combine these checks?
I think this will throw an exception if
$field_list
isNULL|FALSE
(even though we're checking for it invalidateReferencedResource
) because you've type-hinted to the interface.nice
Comment #10
e0ipsoI think that's a great idea. It's totally out of scope, so we should create a follow up instead. We should not just stop at the ones I noticed, but use static analysis to make sure we catch them all and relay them in the appropriate way.
The patch addresses the other concerns.
Comment #11
gabesullicePatch looks good to me. Let's create that follow up or add it to the scope of #2934362: Specify a "code" for every exception that JSON API throws.
Comment #12
Wim LeersNote that this could use
assert(is_null($field_list) || $field_list instanceof EntityReferenceFieldItemListInterface);
Any reason to not do that?
Then we at least keep the strict type checking :)
Comment #13
e0ipsoComment #15
e0ipsoTests are passing locally. Testbot fails seem unrelated to the patch.
Merging.
Comment #17
Wim LeersYep, that was an infra fail. #13 is green now :)