mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Only display filters on collections GET services
This commit is contained in:
parent
a68dcfe829
commit
12372cca00
@ -19,6 +19,7 @@ use Dunglas\ApiBundle\Mapping\ClassMetadataFactoryInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Nelmio\ApiDocBundle\Extractor\AnnotationsProviderInterface;
|
||||
use Nelmio\ApiDocBundle\Parser\DunglasApiParser;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Creates ApiDoc annotations for DunglasApiBundle.
|
||||
@ -125,12 +126,14 @@ class DunglasApiProvider implements AnnotationsProviderInterface
|
||||
$data['output'] = sprintf('%s:%s', DunglasApiParser::OUT_PREFIX, $entityClass);
|
||||
}
|
||||
|
||||
if (Request::METHOD_GET === $method && $collection) {
|
||||
$data['filters'] = [];
|
||||
foreach ($resource->getFilters() as $filter) {
|
||||
foreach ($filter->getDescription($resource) as $name => $definition) {
|
||||
$data['filters'][] = ['name' => $name] + $definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$apiDoc = new ApiDoc($data);
|
||||
$apiDoc->setRoute($route);
|
||||
|
Loading…
x
Reference in New Issue
Block a user