core
core copied to clipboard
Using routeName in resource with xml configration generates an error
API Platform version(s) affected: 3.2
Description
Using routeName in resource with XML configuration generates an error. It works ok when using attributes.
The following error occurs in the console:
Element '{https://api-platform.com/schema/metadata/resources-3.0}operation', attribute 'routeName': The attribute 'routeName' is not allowed.
How to reproduce
The example is from your own documentation. See https://api-platform.com/docs/core/controllers/
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\Get" />
<operation class="ApiPlatform\Metadata\Post" name="post_publication" routeName="book_post_publication" />
<operation class="ApiPlatform\Metadata\Post" name="book_post_discontinuation" />
</operations>
</resource>
</resources>
Fixed in c083af346 — the routeName attribute is now declared in the XML schema (src/Metadata/Extractor/schema/resources.xsd) and covered by XmlExtractorTest. Verified on current 4.3 HEAD. Closing as fixed.