From ead3902a15e37dde3e0c16a096d5eb4a58cfe46d Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 3 Dec 2026 15:40:32 +0100 Subject: [PATCH 1/2] test(serializer): normalize outputs in a single pass Refs #8849 --- .../ApiResource/CollectedOutputDto.php | 21 ++++++++ src/Serializer/Tests/ItemNormalizerTest.php | 51 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/Serializer/Tests/Fixtures/ApiResource/CollectedOutputDto.php diff --git a/src/Serializer/Tests/Fixtures/ApiResource/CollectedOutputDto.php b/src/Serializer/Tests/Fixtures/ApiResource/CollectedOutputDto.php new file mode 100644 index 00000000000..0ac1e1e3133 --- /dev/null +++ b/src/Serializer/Tests/Fixtures/ApiResource/CollectedOutputDto.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace ApiPlatform\Serializer\Tests\Fixtures\ApiResource; + +final class CollectedOutputDto +{ + public function __construct(public string $name = '') + { + } +} diff --git a/src/Serializer/Tests/ItemNormalizerTest.php b/src/Serializer/Tests/ItemNormalizerTest.php index 8ed4b0364b4..8a2cbf3541c 100644 --- a/src/Serializer/Tests/ItemNormalizerTest.php +++ b/src/Serializer/Tests/ItemNormalizerTest.php @@ -14,12 +14,19 @@ namespace ApiPlatform\Serializer\Tests; use ApiPlatform\Metadata\ApiProperty; +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\IriConverterInterface; +use ApiPlatform\Metadata\NotExposed; +use ApiPlatform\Metadata\Operations; use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface; use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; use ApiPlatform\Metadata\Property\PropertyNameCollection; +use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface; +use ApiPlatform\Metadata\Resource\ResourceMetadataCollection; use ApiPlatform\Metadata\ResourceClassResolverInterface; use ApiPlatform\Serializer\ItemNormalizer; +use ApiPlatform\Serializer\Tests\Fixtures\ApiResource\CollectedOutputDto; use ApiPlatform\Serializer\Tests\Fixtures\ApiResource\Dummy; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\IgnoreDeprecations; @@ -172,4 +179,48 @@ public function testDenormalizeIsDeprecated(): void ['resource_class' => Dummy::class, 'api_allow_update' => false] ); } + + public function testOutputIsNormalizedWithoutReenteringTheSerializer(): void + { + $output = new CollectedOutputDto(name: 'x'); + $outputContext = ['class' => CollectedOutputDto::class, 'name' => 'CollectedOutputDto']; + + $propertyNameCollectionFactory = $this->createStub(PropertyNameCollectionFactoryInterface::class); + $propertyNameCollectionFactory->method('create')->willReturn(new PropertyNameCollection(['name'])); + + $propertyMetadataFactory = $this->createStub(PropertyMetadataFactoryInterface::class); + $propertyMetadataFactory->method('create')->willReturn((new ApiProperty())->withReadable(true)); + + $iriConverter = $this->createStub(IriConverterInterface::class); + $iriConverter->method('getIriFromResource')->willReturn('/.well-known/genid/1'); + + $resourceClassResolver = $this->createStub(ResourceClassResolverInterface::class); + $resourceClassResolver->method('isResourceClass')->willReturnCallback(static fn (string $class): bool => \in_array($class, [Dummy::class, CollectedOutputDto::class], true)); + $resourceClassResolver->method('getResourceClass')->willReturn(CollectedOutputDto::class); + + $resourceMetadataFactory = $this->createStub(ResourceMetadataCollectionFactoryInterface::class); + $resourceMetadataFactory->method('create')->willReturnCallback(static fn (string $class): ResourceMetadataCollection => new ResourceMetadataCollection($class, [ + (new ApiResource(class: $class, extraProperties: ['collected' => true]))->withOperations(new Operations([ + '_api_'.$class.'_get' => new NotExposed(class: $class, uriTemplate: '/.well-known/genid/{id}', name: '_api_'.$class.'_get'), + ])), + ])); + + $serializer = $this->createMockForIntersectionOfInterfaces([SerializerInterface::class, NormalizerInterface::class]); + $serializer->expects($this->atLeastOnce())->method('normalize')->willReturnCallback(fn (mixed $value): mixed => \is_object($value) ? $this->fail('The output was normalized through the serializer again') : $value); + + $normalizer = new ItemNormalizer( + $propertyNameCollectionFactory, + $propertyMetadataFactory, + $iriConverter, + $resourceClassResolver, + resourceMetadataFactory: $resourceMetadataFactory, + ); + $normalizer->setSerializer($serializer); + + $this->assertEquals(['name' => 'x'], $normalizer->normalize($output, null, [ + 'output' => $outputContext, + 'resource_class' => Dummy::class, + 'operation' => new Get(class: Dummy::class, output: $outputContext), + ])); + } } From 13b29977ee594ba657c8ad4aa754616fde4f9b3e Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 3 Dec 2026 15:49:18 +0100 Subject: [PATCH 2/2] feat(serializer)!: normalize collected outputs in a single pass A collected output class is normalized in place, without going through the serializer a second time. Interface outputs, which are not collected, keep the previous behaviour. The api_resource context key was never set anymore: its branches and the arguments they used are removed from the HAL, JSON:API and GraphQL object normalizers. Refs #8849 --- src/GraphQl/Serializer/ItemNormalizer.php | 8 +++- src/GraphQl/Serializer/ObjectNormalizer.php | 38 +------------------ src/Hal/Serializer/ItemNormalizer.php | 8 +++- src/Hal/Serializer/ObjectNormalizer.php | 27 +------------ .../Tests/Serializer/ObjectNormalizerTest.php | 13 +------ src/JsonApi/Serializer/ItemNormalizer.php | 8 +++- src/JsonApi/Serializer/ObjectNormalizer.php | 25 +++--------- src/JsonLd/Serializer/ItemNormalizer.php | 15 ++++---- src/Laravel/ApiPlatformProvider.php | 5 --- src/Serializer/AbstractItemNormalizer.php | 32 ++++++++++------ .../Bundle/Resources/config/graphql.php | 2 - src/Symfony/Bundle/Resources/config/hal.php | 1 - .../Bundle/Resources/config/jsonapi.php | 2 - 13 files changed, 57 insertions(+), 127 deletions(-) diff --git a/src/GraphQl/Serializer/ItemNormalizer.php b/src/GraphQl/Serializer/ItemNormalizer.php index c318ea7f958..66a230fbd92 100644 --- a/src/GraphQl/Serializer/ItemNormalizer.php +++ b/src/GraphQl/Serializer/ItemNormalizer.php @@ -77,13 +77,17 @@ public function normalize(mixed $data, ?string $format = null, array $context = { $resourceClass = $this->getObjectClass($data); - if ($this->getOutputClass($context)) { + if ($outputClass = $this->getOutputClass($context)) { $context['graphql_identifiers'] = [ self::ITEM_RESOURCE_CLASS_KEY => $context['operation']->getClass(), self::ITEM_IDENTIFIERS_KEY => $this->isBlankNode($resourceClass) ? ['id' => $this->propertyAccessor->getValue($data, 'id')] : $this->identifiersExtractor->getIdentifiersFromItem($data, $context['operation'] ?? null), ]; - return parent::normalize($data, $format, $context); + if (!$this->isCollected($outputClass)) { + return parent::normalize($data, $format, $context); + } + + $context = $this->switchToOutputContext($context, $outputClass); } unset($context['operation_name'], $context['operation']); // Remove operation and operation_name only when cache key has been created diff --git a/src/GraphQl/Serializer/ObjectNormalizer.php b/src/GraphQl/Serializer/ObjectNormalizer.php index f87768afb55..b7796c9bd9d 100644 --- a/src/GraphQl/Serializer/ObjectNormalizer.php +++ b/src/GraphQl/Serializer/ObjectNormalizer.php @@ -13,9 +13,6 @@ namespace ApiPlatform\GraphQl\Serializer; -use ApiPlatform\Metadata\IdentifiersExtractorInterface; -use ApiPlatform\Metadata\IriConverterInterface; -use ApiPlatform\Metadata\Util\ClassInfoTrait; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -25,13 +22,9 @@ */ final class ObjectNormalizer implements NormalizerInterface { - use ClassInfoTrait; - public const FORMAT = 'graphql'; - public const ITEM_RESOURCE_CLASS_KEY = '#itemResourceClass'; - public const ITEM_IDENTIFIERS_KEY = '#itemIdentifiers'; - public function __construct(private readonly NormalizerInterface $decorated, private readonly IriConverterInterface $iriConverter, private readonly IdentifiersExtractorInterface $identifiersExtractor) + public function __construct(private readonly NormalizerInterface $decorated) { } @@ -58,41 +51,12 @@ public function getSupportedTypes(?string $format): array */ public function normalize(mixed $data, ?string $format = null, array $context = []): array { - if (isset($context['api_resource'])) { - $originalResource = $context['api_resource']; - unset($context['api_resource']); - } - $normalizedData = $this->decorated->normalize($data, $format, $context); - // The default circular_reference_handler returns the visited object's IRI - // as a string; return an identifier-only node so the GraphQL field shape - // is preserved instead of crashing. - if (\is_string($normalizedData) && isset($originalResource)) { - return [ - self::ITEM_RESOURCE_CLASS_KEY => $this->getObjectClass($originalResource), - self::ITEM_IDENTIFIERS_KEY => $this->identifiersExtractor->getIdentifiersFromItem($originalResource), - ]; - } - if (!\is_array($normalizedData)) { throw new UnexpectedValueException('Expected data to be an array.'); } - if (!isset($originalResource)) { - return $normalizedData; - } - - if (isset($normalizedData['id'])) { - $normalizedData['_id'] = $normalizedData['id']; - $normalizedData['id'] = $this->iriConverter->getIriFromResource($originalResource); - } - - if (!($context['no_resolver_data'] ?? false)) { - $normalizedData[self::ITEM_RESOURCE_CLASS_KEY] = $this->getObjectClass($originalResource); - $normalizedData[self::ITEM_IDENTIFIERS_KEY] = $this->identifiersExtractor->getIdentifiersFromItem($originalResource); - } - return $normalizedData; } } diff --git a/src/Hal/Serializer/ItemNormalizer.php b/src/Hal/Serializer/ItemNormalizer.php index 6925be26cd9..c55eb0a59fc 100644 --- a/src/Hal/Serializer/ItemNormalizer.php +++ b/src/Hal/Serializer/ItemNormalizer.php @@ -93,8 +93,12 @@ public function getSupportedTypes(?string $format): array public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($data); - if ($this->getOutputClass($context)) { - return parent::normalize($data, $format, $context); + if ($outputClass = $this->getOutputClass($context)) { + if (!$this->isCollected($outputClass)) { + return parent::normalize($data, $format, $context); + } + + $context = $this->switchToOutputContext($context, $outputClass); } $previousResourceClass = $context['resource_class'] ?? null; diff --git a/src/Hal/Serializer/ObjectNormalizer.php b/src/Hal/Serializer/ObjectNormalizer.php index 5e52ca9075c..09c159ed04c 100644 --- a/src/Hal/Serializer/ObjectNormalizer.php +++ b/src/Hal/Serializer/ObjectNormalizer.php @@ -13,7 +13,6 @@ namespace ApiPlatform\Hal\Serializer; -use ApiPlatform\Metadata\IriConverterInterface; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -26,7 +25,7 @@ final class ObjectNormalizer implements NormalizerInterface, DenormalizerInterfa { public const FORMAT = 'jsonhal'; - public function __construct(private readonly NormalizerInterface $decorated, private readonly IriConverterInterface $iriConverter) + public function __construct(private readonly NormalizerInterface $decorated) { } @@ -51,29 +50,7 @@ public function getSupportedTypes(?string $format): array */ public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - if (isset($context['api_resource'])) { - $originalResource = $context['api_resource']; - unset($context['api_resource']); - } - - $normalizedData = $this->decorated->normalize($data, $format, $context); - if (!\is_array($normalizedData)) { - return $normalizedData; - } - - if (!isset($originalResource)) { - return $normalizedData; - } - - $metadata = [ - '_links' => [ - 'self' => [ - 'href' => $this->iriConverter->getIriFromResource($originalResource), - ], - ], - ]; - - return $metadata + $normalizedData; + return $this->decorated->normalize($data, $format, $context); } /** diff --git a/src/Hal/Tests/Serializer/ObjectNormalizerTest.php b/src/Hal/Tests/Serializer/ObjectNormalizerTest.php index 705fad99fb8..33a0dad9ed4 100644 --- a/src/Hal/Tests/Serializer/ObjectNormalizerTest.php +++ b/src/Hal/Tests/Serializer/ObjectNormalizerTest.php @@ -15,7 +15,6 @@ use ApiPlatform\Hal\Serializer\ObjectNormalizer; use ApiPlatform\Hal\Tests\Fixtures\Dummy; -use ApiPlatform\Metadata\IriConverterInterface; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Exception\LogicException; @@ -32,12 +31,8 @@ public function testDoesNotSupportDenormalization(): void $this->expectExceptionMessage('jsonhal is a read-only format.'); $normalizerInterfaceMock = $this->createMock(NormalizerInterface::class); - $iriConverterMock = $this->createMock(IriConverterInterface::class); - $normalizer = new ObjectNormalizer( - $normalizerInterfaceMock, - $iriConverterMock - ); + $normalizer = new ObjectNormalizer($normalizerInterfaceMock); $this->assertFalse($normalizer->supportsDenormalization('foo', 'type', 'format')); $normalizer->denormalize(['foo'], 'Foo'); @@ -50,11 +45,7 @@ public function testSupportsNormalization(): void $dummy = new Dummy(); $normalizerInterfaceMock = $this->createMock(NormalizerInterface::class); - $iriConverterMock = $this->createMock(IriConverterInterface::class); - $normalizer = new ObjectNormalizer( - $normalizerInterfaceMock, - $iriConverterMock - ); + $normalizer = new ObjectNormalizer($normalizerInterfaceMock); $normalizerInterfaceMock->method('supportsNormalization')->willReturn(true); diff --git a/src/JsonApi/Serializer/ItemNormalizer.php b/src/JsonApi/Serializer/ItemNormalizer.php index 4758fe6445d..fcb8f028221 100644 --- a/src/JsonApi/Serializer/ItemNormalizer.php +++ b/src/JsonApi/Serializer/ItemNormalizer.php @@ -119,8 +119,12 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($data); - if ($this->getOutputClass($context)) { - return parent::normalize($data, $format, $context); + if ($outputClass = $this->getOutputClass($context)) { + if (!$this->isCollected($outputClass)) { + return parent::normalize($data, $format, $context); + } + + $context = $this->switchToOutputContext($context, $outputClass); } $previousResourceClass = $context['resource_class'] ?? null; diff --git a/src/JsonApi/Serializer/ObjectNormalizer.php b/src/JsonApi/Serializer/ObjectNormalizer.php index 5ea74b1f4c3..ba43765f0cd 100644 --- a/src/JsonApi/Serializer/ObjectNormalizer.php +++ b/src/JsonApi/Serializer/ObjectNormalizer.php @@ -14,8 +14,6 @@ namespace ApiPlatform\JsonApi\Serializer; use ApiPlatform\Metadata\IriConverterInterface; -use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface; -use ApiPlatform\Metadata\ResourceClassResolverInterface; use ApiPlatform\Metadata\Util\ClassInfoTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -29,7 +27,7 @@ final class ObjectNormalizer implements NormalizerInterface public const FORMAT = 'jsonapi'; - public function __construct(private readonly NormalizerInterface $decorated, private readonly IriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface $resourceClassResolver, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory) + public function __construct(private readonly NormalizerInterface $decorated, private readonly IriConverterInterface $iriConverter) { } @@ -54,28 +52,15 @@ public function getSupportedTypes(?string $format): array */ public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - if (isset($context['api_resource'])) { - $originalResource = $context['api_resource']; - unset($context['api_resource']); - } - $normalizedData = $this->decorated->normalize($data, $format, $context); if (!\is_array($normalizedData) || isset($context['api_attribute'])) { return $normalizedData; } - if (isset($originalResource)) { - $resourceClass = $this->resourceClassResolver->getResourceClass($originalResource); - $resourceData = [ - 'id' => $this->iriConverter->getIriFromResource($originalResource), - 'type' => $this->resourceMetadataFactory->create($resourceClass)->getOperation()->getShortName(), - ]; - } else { - $resourceData = [ - 'id' => $this->iriConverter->getIriFromResource($data), - 'type' => (new \ReflectionClass($this->getObjectClass($data)))->getShortName(), - ]; - } + $resourceData = [ + 'id' => $this->iriConverter->getIriFromResource($data), + 'type' => (new \ReflectionClass($this->getObjectClass($data)))->getShortName(), + ]; if ($normalizedData) { $resourceData['attributes'] = $normalizedData; diff --git a/src/JsonLd/Serializer/ItemNormalizer.php b/src/JsonLd/Serializer/ItemNormalizer.php index d3047f92eb5..440fca06580 100644 --- a/src/JsonLd/Serializer/ItemNormalizer.php +++ b/src/JsonLd/Serializer/ItemNormalizer.php @@ -80,10 +80,13 @@ public function getSupportedTypes(?string $format): array public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($data); - $outputClass = $this->getOutputClass($context); - if ($outputClass && !($context['item_uri_template'] ?? null)) { - return parent::normalize($data, $format, $context); + if ($outputClass = $this->getOutputClass($context)) { + if (!$this->isCollected($outputClass)) { + return parent::normalize($data, $format, $context); + } + + $context = $this->switchToOutputContext($context, $outputClass); } // TODO: we should not remove the resource_class in the normalizeRawCollection as we would find out anyway that it's not the same as the requested one @@ -93,9 +96,7 @@ public function normalize(mixed $data, ?string $format = null, array $context = if ($isResourceClass && (null === $previousResourceClass || $this->resourceClassResolver->isResourceClass($previousResourceClass))) { $resourceClass = $this->resourceClassResolver->getResourceClass($data, $previousResourceClass); if (isset($context['operation']) && $context['operation'] instanceof HttpOperation && $context['operation']->getClass() !== $resourceClass) { - $context['operation'] = isset($context['item_uri_template']) && $outputClass && $this->operationMetadataFactory - ? $this->operationMetadataFactory->create($context['item_uri_template']) - : $this->resourceMetadataCollectionFactory->create($resourceClass)->getOperation(null, false, true); + $context['operation'] = $this->resourceMetadataCollectionFactory->create($resourceClass)->getOperation(null, false, true); } $context = $this->initContext($resourceClass, $context); $metadata = $this->addJsonLdContext($this->contextBuilder, $resourceClass, $context); @@ -117,7 +118,7 @@ public function normalize(mixed $data, ?string $format = null, array $context = } // Special case: non-resource got serialized and contains a resource therefore we need to reset part of the context - if ($previousResourceClass !== $resourceClass && $resourceClass !== $outputClass) { + if ($previousResourceClass !== $resourceClass) { unset($context['operation'], $context['operation_name'], $context['output']); } diff --git a/src/Laravel/ApiPlatformProvider.php b/src/Laravel/ApiPlatformProvider.php index 6216310c069..6a31dc3b720 100644 --- a/src/Laravel/ApiPlatformProvider.php +++ b/src/Laravel/ApiPlatformProvider.php @@ -811,7 +811,6 @@ public function register(): void $this->app->singleton(HalObjectNormalizer::class, static function (Application $app) { return new HalObjectNormalizer( $app->make(ObjectNormalizer::class), - $app->make(IriConverterInterface::class) ); }); @@ -1165,8 +1164,6 @@ public function register(): void return new JsonApiObjectNormalizer( $app->make(ObjectNormalizer::class), $app->make(IriConverterInterface::class), - $app->make(ResourceClassResolverInterface::class), - $app->make(ResourceMetadataCollectionFactoryInterface::class), ); }); @@ -1500,8 +1497,6 @@ private function registerGraphQl(): void $this->app->singleton(GraphQlObjectNormalizer::class, static function (Application $app) { return new GraphQlObjectNormalizer( $app->make(ObjectNormalizer::class), - $app->make(IriConverterInterface::class), - $app->make(IdentifiersExtractorInterface::class), ); }); diff --git a/src/Serializer/AbstractItemNormalizer.php b/src/Serializer/AbstractItemNormalizer.php index 19f89713db9..c8ea41a564e 100644 --- a/src/Serializer/AbstractItemNormalizer.php +++ b/src/Serializer/AbstractItemNormalizer.php @@ -164,18 +164,16 @@ public function normalize(mixed $data, ?string $format = null, array $context = // Prevent force_resource_class from leaking to child property normalizations unset($context['force_resource_class']); if ($outputClass = $this->getOutputClass($context)) { - if (!$this->serializer instanceof NormalizerInterface) { - throw new LogicException('Cannot normalize the output because the injected serializer is not a normalizer'); - } - - unset($context['output'], $context['operation'], $context['operation_name']); - $context['resource_class'] = $outputClass; - $context['api_sub_level'] = true; - $context['api_platform_output'] = true; - $context['api_platform_output_class'] = $outputClass; - $context[self::ALLOW_EXTRA_ATTRIBUTES] = false; + if ($this->isCollected($outputClass)) { + $context = $this->switchToOutputContext($context, $outputClass); + $resourceClass = $outputClass; + } else { + if (!$this->serializer instanceof NormalizerInterface) { + throw new LogicException('Cannot normalize the output because the injected serializer is not a normalizer'); + } - return $this->serializer->normalize($data, $format, $context); + return $this->serializer->normalize($data, $format, $this->switchToOutputContext($context, $outputClass)); + } } // Never remove this, with `application/json` we don't use our AbstractCollectionNormalizer and we need @@ -1337,6 +1335,18 @@ protected function normalizeCollectionOfRelations(ApiProperty $propertyMetadata, return $value; } + protected function switchToOutputContext(array $context, string $outputClass): array + { + unset($context['output'], $context['operation'], $context['operation_name']); + $context['resource_class'] = $outputClass; + $context['api_sub_level'] = true; + $context['api_platform_output'] = true; + $context['api_platform_output_class'] = $outputClass; + $context[self::ALLOW_EXTRA_ATTRIBUTES] = false; + + return $context; + } + protected function isCollected(string $class): bool { return $this->resourceClassResolver->isResourceClass($class) && ($this->resourceMetadataCollectionFactory?->create($class)->isCollected() ?? false); diff --git a/src/Symfony/Bundle/Resources/config/graphql.php b/src/Symfony/Bundle/Resources/config/graphql.php index 429ce2e2b60..b1be0d1a519 100644 --- a/src/Symfony/Bundle/Resources/config/graphql.php +++ b/src/Symfony/Bundle/Resources/config/graphql.php @@ -271,8 +271,6 @@ $services->set('api_platform.graphql.normalizer.object', ObjectNormalizer::class) ->args([ service('api_platform.normalizer.object'), - service('api_platform.symfony.iri_converter'), - service('api_platform.api.identifiers_extractor'), ]) ->tag('serializer.normalizer', ['priority' => -995]); diff --git a/src/Symfony/Bundle/Resources/config/hal.php b/src/Symfony/Bundle/Resources/config/hal.php index 2be5d2d8f1a..4764c6e9e34 100644 --- a/src/Symfony/Bundle/Resources/config/hal.php +++ b/src/Symfony/Bundle/Resources/config/hal.php @@ -73,7 +73,6 @@ $services->set('api_platform.hal.normalizer.object', ObjectNormalizer::class) ->args([ service('api_platform.normalizer.object'), - service('api_platform.iri_converter'), ]) ->tag('serializer.normalizer', ['priority' => -995]); }; diff --git a/src/Symfony/Bundle/Resources/config/jsonapi.php b/src/Symfony/Bundle/Resources/config/jsonapi.php index 6eaac1ddc2d..873aeaaccef 100644 --- a/src/Symfony/Bundle/Resources/config/jsonapi.php +++ b/src/Symfony/Bundle/Resources/config/jsonapi.php @@ -114,8 +114,6 @@ ->args([ service('api_platform.normalizer.object'), service('api_platform.iri_converter'), - service('api_platform.resource_class_resolver'), - service('api_platform.metadata.resource.metadata_collection_factory'), ]) ->tag('serializer.normalizer', ['priority' => -995]);