Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
jsonapi.module
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Mar 2018 at 11:18 UTC
Updated:
28 Aug 2019 at 00:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersHow is this related to #2929932: Work around core's ill-designed @FieldType-level TimestampItemNormalizer normalization until #2926508 lands?
AFAICT the problem is that
\Drupal\jsonapi\Normalizer\EntityReferenceFieldNormalizer::normalize()collects entity metadata (see$entity_list_metadata), passes that tonew Relationship(…, $entity_list_metadata, …), this gets normalized in\Drupal\jsonapi\Normalizer\Value\RelationshipItemNormalizerValue::rasterizeValue()and hence ends up being exposed.Comment #3
gabesulliceI didn't look into this at all. They seemed similar because they're both related to file normalization. Since you've looked at this and are familiar w/ the other issue and don't see a connection, we can consider the question answered (the answer seems to be "no") :P
Comment #4
wim leersHeh :P
I think this needs feedback from @e0ipso.
AFAICT this is very much intentional…
Comment #5
e0ipsoHmm, what's the motivation to remove this? JSON API's relational approach is a pure link. A relationship cannot be contextualized because it's only a type and an ID. In other words, the relationship itself cannot have extra attributes. In Drupal we can have extra attributes (see the example in the IS). This data does not belong to the image, nor to the article, it belongs to the relationship.
Adding the information to the meta is the only way to stay compliant and be able to access this information from the consumer.
Comment #6
e0ipsoComment #7
gabesulliceI think I originally misunderstood what this was.
Comment #8
berdirThis issue is still referenced in \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedGetRelationshipDocumentData, should we use this to remove that todo? (would need to move to core for that)
Comment #9
wim leersNicely spotted, @Berdir! Crediting @Berdir for this change. Since @Berdir effectively created this patch, I'm directly RTBC'ing this.
Comment #10
larowlanCommitted 9eca7bb and pushed to 8.8.x. Thanks!