Problem/Motivation

Proposed resolution

Remove the normalization of plain-arrays and miscellaneous traversibles from the JSON:API serializer, and allow those to fallback to the fallback normalizer, which means all data contained within them will also be normalized by the fallback normalizer. Alternatively, if we want to support plain-array and miscellaneous traversibles within the JSON:API serializer, we should add a JSON:API normalizer for them, which aggregates the cacheability and returns back a single CacheableNormalization object.

CommentFileSizeAuthor
#2 jsonapi-fallback-normalizer.patch1.73 KBeffulgentsia

Comments

effulgentsia created an issue. See original summary.

effulgentsia’s picture

Status: Active » Needs review
StatusFileSize
new1.73 KB
gabesullice’s picture

Issue tags: +API-First Initiative

This patch makes use of the existing behavior: #3024896-50: Remove Relationship and RelationshipItem classes

See line 79 of the green additions under EntityReferenceFieldNormalizer.


I realize now that I didn't quite understand what you were doing in 9.3 of #3029897-9: [PP-1] Do not overload Symfony's normalize() method to return objects; define a new interface for that. but I think I "get it" now.

In #15 of #3029897-15: [PP-1] Do not overload Symfony's normalize() method to return objects; define a new interface for that., you said that this issue could:

either remove support for this entirely, or to handle it better (e.g., by performing proper cacheable normalization aggregation for these cases).

Could we try the latter once #3029897 lands? I'd be happy to write that patch.

IMO, the less differently our serializer behaves relative to the core serializer the better. I'm still dreaming of the day that we can just drop all our custom normalizer stuff because it's no longer necessary.

gabesullice’s picture

wim leers’s picture

Title: Do not auto-traverse arrays/traversibles within the JSON:API serializer » [PP-1] Do not auto-traverse arrays/traversibles within the JSON:API serializer
Status: Needs review » Postponed
wim leers’s picture

Category: Bug report » Task

Nothing is broken, so I don't think this is a bug?