Open dannyvw opened 1 year ago
Indeed, in 2.6 this was not supported but now it should work as well with simple get operations. I'm not sure I want to fix this quite yet as I want the filters to be refactored for next year. Basically https://github.com/api-platform/api-platform/discussions/1724, probably also handle some kind of validation (we have this but architecture is quite distant from filtering) and transformation (https://github.com/symfony/symfony/pull/49134) from the query parameters may be of some interest.
I'll be alright with a fix on the documentation but it'll not work with doctrine (and will not be supported by the default providers for now).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This should still be fixed
I think the issue is not solved, or maybe I'm missing something but in my case, using api plarform v3.2.16 I still don't have the filter in the doc.
Here's my resource:
<?php
declare(strict_types=1);
namespace App\Catalog\Infrastructure\Symfony\Resource;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Serializer\Filter\PropertyFilter;
#[Get]
#[GetCollection]
#[ApiFilter(PropertyFilter::class)]
class Menu
{
#[ApiProperty(identifier: true)]
public ?string $uuid;
public string $name;
public array $tags = [];
public array $channels = [];
}
Here's the generated doc:
The filter actually works however if I do curl -X 'GET' 'http://localhost:8000/api/menus/018e33a1-2fee-735a-949c-4ea67d7a2dee?properties[]=name' -H 'accept: application/json'
Description
Filters applied on GET operation are not added to the docs. It is only applied for CollectionOperationInterface https://github.com/api-platform/core/blob/main/src/OpenApi/Factory/OpenApiFactory.php#L271
Is there any reason that this is only applied for CollectionOperationInterface?