API Platform version(s) affected: 4.3.1
Description
2 APIs:
- 1 : use DTO A as output
- 2 : use DTO B as output
DTO B has a property that is an array of DTO A
On non worker mode:
- call API 1 : ItemNormalizer is used on DTO A
- call API 2 : ObjectNormalizer is used on the array of DTO A
Difference is produce by AbstractItemNormalizer:115, on API 1 condition return true and on API 2 false
if (($context['output']['class'] ?? null) === $class) {
return true;
}
On worker mode:
- call API 1 : ItemNormalizer is used on DTO A and result is set on serializer cache
- call API 2 : because previous call cache ItemNormalizer as true for DTO A in normalizer cache of serializer, ItemNormalizer is used again and produce this error
ApiPlatform\Metadata\ResourceClassResolver::isResourceClass(): Argument #1 ($type) must be of type string, null given, called in vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 461 because $context['resource_class'] is unset before serialization of the array of DTO A
Tested on jsonLD and json formats
API Platform version(s) affected: 4.3.1
Description
2 APIs:
DTO B has a property that is an array of DTO A
On non worker mode:
Difference is produce by AbstractItemNormalizer:115, on API 1 condition return true and on API 2 false
On worker mode:
ApiPlatform\Metadata\ResourceClassResolver::isResourceClass(): Argument #1 ($type) must be of type string, null given, called in vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 461because$context['resource_class']is unset before serialization of the array of DTO ATested on jsonLD and json formats