Skip to content

Commit

Permalink
fix(metadata): allow extracting routeName from XML config
Browse files Browse the repository at this point in the history
  • Loading branch information
JacquesDurand committed Apr 22, 2024
1 parent 50c738c commit 3ab082a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Metadata/Extractor/XmlResourceExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ private function buildOperations(\SimpleXMLElement $resource, array $root): ?arr
'queryParameterValidate' => $this->phpize($operation, 'queryParameterValidate', 'bool'),
'priority' => $this->phpize($operation, 'priority', 'integer'),
'name' => $this->phpize($operation, 'name', 'string'),
'routeName' => $this->phpize($operation, 'routeName', 'string'),
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Metadata/Extractor/schema/resources.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<xsd:attribute type="xsd:positiveInteger" name="priority"/>
<xsd:attribute type="xsd:string" name="name"/>
<xsd:attribute type="xsd:string" name="itemUriTemplate"/>
<xsd:attribute type="xsd:string" name="routeName"/>
</xsd:complexType>

<xsd:complexType name="graphQlOperations">
Expand Down
2 changes: 2 additions & 0 deletions src/Metadata/Tests/Extractor/XmlExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public function testValidXML(): void
'itemUriTemplate' => null,
'stateOptions' => null,
'links' => null,
'routeName' => 'custom_route_name',
],
[
'name' => null,
Expand Down Expand Up @@ -373,6 +374,7 @@ public function testValidXML(): void
'provider' => null,
'stateOptions' => null,
'links' => null,
'routeName' => null,
],
],
'graphQlOperations' => null,
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/Tests/Extractor/xml/valid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</exceptionToStatus>

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

0 comments on commit 3ab082a

Please sign in to comment.