Skip to content

Commit e579a58

Browse files
committed
fix(jsonapi): restore getSupportedTypes override in ItemNormalizer
The normalizer/denormalizer split accidentally dropped this override. Without it, JsonApi\Serializer\ItemNormalizer inherits the parent's generic implementation (returns ['object' => false] for any format), which breaks Symfony Serializer fast-path routing — a more generic normalizer can win for formats that should land on the JSON:API one. Restored to the same shape kept by JsonLd\Serializer\ItemNormalizer post-split, matching the pre-split behavior.
1 parent 77d9964 commit e579a58

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/JsonApi/Serializer/ItemNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public function supportsNormalization(mixed $data, ?string $format = null, array
8686
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context) && !($data instanceof \Exception || $data instanceof FlattenException);
8787
}
8888

89+
public function getSupportedTypes(?string $format): array
90+
{
91+
return self::FORMAT === $format ? parent::getSupportedTypes($format) : [];
92+
}
93+
8994
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
9095
{
9196
trigger_deprecation('api-platform/core', '4.4', 'Calling "denormalize()" on "%s" is deprecated, use "%s" instead.', self::class, ItemDenormalizer::class);

0 commit comments

Comments
 (0)