Problem/Motivation
#2940342: Cacheability metadata on an entity fields' properties is lost added this @todo:
// @todo Use the constant \Drupal\serialization\Normalizer\CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY instead of the 'cacheability' string when JSON API requires Drupal 8.5 or newer.
Proposed resolution
JSON API 2.x requires Drupal >=8.5.4, so we can now do this.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3008544-6.patch | 7.94 KB | wim leers |
| #6 | interdiff.txt | 547 bytes | wim leers |
| #4 | 3008544-4.patch | 7.66 KB | wim leers |
| #4 | interdiff.txt | 5.52 KB | wim leers |
| #3 | 3008544-3.patch | 2.17 KB | wim leers |
Comments
Comment #2
wim leersComment #3
wim leersComment #4
wim leersI just realized that we're only doing this for
FieldItemNormalizer, i.e. for properties on fields that are not entity references. In case of entity references, properties are normalized directly in\Drupal\jsonapi\Normalizer\EntityReferenceFieldNormalizer::normalize().This went unnoticed so far because no
EntityReferenceItemsubclasses exist in Drupal core that have properties with cacheability.Comment #6
wim leersComment #7
gabesulliceIn confused. I thought you went through a lot of effort to get rid of this altogether, using normalizer value objects to carry cacheability. What am I missing?
Comment #8
wim leersThat is still the case. But it's only the case for
@EntityType-level and@FieldType-level data. It's not the case for@DataType-level ("field property level") data.Comment #9
gabesulliceAh, makes sense. Looks good.
Comment #11
gabesulliceBoom.