Skip to content

Commit c083af3

Browse files
fix(metadata): allow extracting routeName from XML config (#6329)
1 parent 50c738c commit c083af3

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

src/Metadata/Extractor/XmlResourceExtractor.php

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ private function buildOperations(\SimpleXMLElement $resource, array $root): ?arr
404404
'queryParameterValidate' => $this->phpize($operation, 'queryParameterValidate', 'bool'),
405405
'priority' => $this->phpize($operation, 'priority', 'integer'),
406406
'name' => $this->phpize($operation, 'name', 'string'),
407+
'routeName' => $this->phpize($operation, 'routeName', 'string'),
407408
]);
408409
}
409410

src/Metadata/Extractor/schema/resources.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<xsd:attribute type="xsd:positiveInteger" name="priority"/>
4949
<xsd:attribute type="xsd:string" name="name"/>
5050
<xsd:attribute type="xsd:string" name="itemUriTemplate"/>
51+
<xsd:attribute type="xsd:string" name="routeName"/>
5152
</xsd:complexType>
5253

5354
<xsd:complexType name="graphQlOperations">

src/Metadata/Tests/Extractor/XmlExtractorTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ public function testValidXML(): void
273273
'itemUriTemplate' => null,
274274
'stateOptions' => null,
275275
'links' => null,
276+
'routeName' => 'custom_route_name',
276277
],
277278
[
278279
'name' => null,
@@ -373,6 +374,7 @@ public function testValidXML(): void
373374
'provider' => null,
374375
'stateOptions' => null,
375376
'links' => null,
377+
'routeName' => null,
376378
],
377379
],
378380
'graphQlOperations' => null,

src/Metadata/Tests/Extractor/xml/valid.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</exceptionToStatus>
9696

9797
<operations>
98-
<operation class="ApiPlatform\Metadata\GetCollection" name="custom_operation_name"/>
98+
<operation class="ApiPlatform\Metadata\GetCollection" name="custom_operation_name" routeName="custom_route_name"/>
9999
<operation class="ApiPlatform\Metadata\Get" uriTemplate="/users/{userId}/comments/{id}{._format}">
100100
<uriVariables>
101101
<uriVariable parameterName="userId" fromClass="ApiPlatform\Metadata\Tests\Fixtures\ApiResource\User" fromProperty="author"/>

0 commit comments

Comments
 (0)