Description
In Sylius, we use the API Platform and have all resources configured in XML. However, it is important for us to be able to extend or overwrite these configurations in the end applications. At this point, when using XML configurations in the end application, everything works fine. Unfortunately, using YAML no longer works, because instead of adding a new ApiResource, it overwrites the existing one already in the metadata due to the incrementation from 0 when loading the configuration of each extension.
API Platform version(s) affected: 3.3.13
Description In Sylius, we use the API Platform and have all resources configured in XML. However, it is important for us to be able to extend or overwrite these configurations in the end applications. At this point, when using XML configurations in the end application, everything works fine. Unfortunately, using YAML no longer works, because instead of adding a new ApiResource, it overwrites the existing one already in the metadata due to the incrementation from 0 when loading the configuration of each extension.
The problematic line: https://github.com/api-platform/core/blob/3.3/src/Metadata/Resource/Factory/ExtractorResourceMetadataCollectionFactory.php#L63
TL;DR: there is no way to use both configurations in XML and YAML at the same time, because YAML overwrites XML in unforeseen way.
How to reproduce
Add at the same time the configuration in XML and YAML for the same ApiResource.
Possible Solution
A potential solution would be such a simply change in
ExtractorResourceMetadataCollectionFactory.php
: