Closed (fixed)
Project:
JSON:API
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Jul 2018 at 20:59 UTC
Updated:
3 Aug 2018 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gabesulliceAlright! Looks like we managed to simplify EntityResource quite a bit. More deletions than insertions :)
Let's see what testbot thinks.
Comment #4
gabesulliceSneaky.
This should pass 🤞
Comment #5
e0ipsoShould we check that there is cache context per user?
Comment #7
gabesullice@e0ipso, done!
I was a little worried that the last cache pieces wasn't caught by the ResourceTestBase tests. Turns out that the primary entity cache tag is added in the normalizers, so the functional tests did see the right set of tags.
I don't see the harm in adding it in the controller though. So I did that along with asserting the user cache context.
Comment #8
gabesulliceComment #9
wim leersI do — it's duplicating logic in multiple places, which then is confusing. The controller's job is to create a
ResourceResponseobject containing aJsonApiDocumentTopLevelobject that contains the entities/entity collection/exceptions to normalize. The normalization happens inResourceResponseSubcriber, and that is when cacheability is determined and associated.At the time of the controller execution, there is no need to worry about cacheability of the values about to be normalized, because values haven't yet been normalized.
Comment #10
gabesulliceNBD, done!
Comment #11
wim leersI think I see several scope creep things, sorry :( Those bits of scope creep make this patch much complex than it would've been if it did only what the title indicates it does.
This is the change that the issue title is talking about! 👌
I like this tightening! But very much out of scope AFAICT. Let's do this in a separate issue.
Also: I am concerned about hardcoding those "extra parameters" in
RequestHandler. I think a better solution is to use the arguments resolver like REST started doing in #2720233: Use arguments resolver in RequestHandler to have consistent parameter ordering — thanks to @dawehner for that one! :)The issue title suggests this is only about throwing the appropriate exception.
This goes quite a bit further: it refactors the existing logic from returning a pair (entity + access) to returning an access-checked entity object (entity object with access result cacheability, IF accessible), or an access-checked label, or an exception object.
AFAICT this is out of scope? Or am I not seeing why this is necessary for point 1?
Comment #12
gabesullice1. Indeed.
2. *sigh* you're right. removed :)
3. Yes, it's more than the the issue title said. Without it, it's a change without a benefit, but also not any consequence. We can have a followup for it. I'll do that next.
Comment #13
gabesullice12.3 Done.
Comment #14
gabesulliceFollowup created: #2987206: Refactor `getEntityAndAccess` to return cacheable objects with access cacheability rather than an entity/access pair.
Comment #15
wim leersWaiting for tests to pass, then I'll commit this!
Unnecessary. I'll remove these on commit.
Comment #16
wim leers