Closed (fixed)
Project:
JSON:API
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Dec 2018 at 21:51 UTC
Updated:
1 Jan 2019 at 13:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gabesulliceComment #3
gabesulliceThis one was the most complicated of the backports because the code in
JsonApiDocumentTopLevelNormalizerTesthad other changes unrelated to this issue in the source patch. I think I've gotten it. If so, tests should be green for 8.x-1.x on 8.5, 8.6 & 8.7.Comment #4
gabesulliceThe attached patch fixes 8.6 and 8.7, but breaks on 8.5 (a regression).
It's midnight for me, so I'll let @Wim Leers take over from here.
Once this lands, #3021056: Backport #3005826 to 1.x: JSON API + hook_node_grants() implementations: count queries still result in cacheability metadata leak should be ready to land. So, if it passes after this is in (or only needs minor changes) it's obviously RTBC from me.
Comment #5
wim leersFirst, I thought this was porting part of #2843922: Show label of inaccessible entities ('view' access denied) when 'view label' access is allowed … but then I realized that in fact it was simply the set of includes that resolves to a differently ordered list on 8.6 vs 8.5.
Why? 🤔
On 8.6 + 8.7, iterating over the fields of a
Nodeentity returnsfield_image, thenfield_tags. On 8.5, it's the other way around!To convince yourself, run
\Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testNormalize()and put a breakpoint inEntityNormalizerValue:__construct(); make it break on the condition$entity instanceof \Drupal\node\NodeInterface, and then evaluate this:You'll be able to confirm the different field order.
We could ask "why?" again, but there's no point to it: this is a subtle change in core that does not change the data model, so it is a fair change. I could find the exact core commit that caused this, but there's no point to doing that other than satisfying our curiosity :)
Comment #6
wim leersGreen on 8.5+8.6+8.7 ✅
Comment #8
wim leers