core icon indicating copy to clipboard operation
core copied to clipboard

Using routeName in resource with xml configration generates an error

Open jphooiveld opened this issue 2 years ago • 0 comments

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>

jphooiveld avatar Dec 08 '23 14:12 jphooiveld