mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Fix _format path parameter removal
This commit is contained in:
parent
ab3dec1125
commit
32dbbade38
@ -26,8 +26,12 @@ final class RouteMetadataDescriber implements RouteDescriberInterface
|
|||||||
$requirements = $route->getRequirements();
|
$requirements = $route->getRequirements();
|
||||||
$compiledRoute = $route->compile();
|
$compiledRoute = $route->compile();
|
||||||
|
|
||||||
// Don't include path variables
|
// Don't include host requirements
|
||||||
foreach ($compiledRoute->getPathVariables() as $pathVariable) {
|
foreach ($compiledRoute->getPathVariables() as $pathVariable) {
|
||||||
|
if ('_format' === $pathVariable) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$parameter = $operation->getParameters()->get($pathVariable, 'path');
|
$parameter = $operation->getParameters()->get($pathVariable, 'path');
|
||||||
$parameter->setRequired(true);
|
$parameter->setRequired(true);
|
||||||
$parameter->setType('string');
|
$parameter->setType('string');
|
||||||
|
@ -47,6 +47,9 @@ class FunctionalTest extends WebTestCase
|
|||||||
$parameters = $operation->getParameters();
|
$parameters = $operation->getParameters();
|
||||||
$this->assertTrue($parameters->has('foo', 'query'));
|
$this->assertTrue($parameters->has('foo', 'query'));
|
||||||
$this->assertTrue($parameters->has('bar', 'formData'));
|
$this->assertTrue($parameters->has('bar', 'formData'));
|
||||||
|
|
||||||
|
// The _format path attribute should be removed
|
||||||
|
$this->assertFalse($parameters->has('_format', 'path'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNelmioAction()
|
public function testNelmioAction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user