Skip to content

Filter deprecation #3622

Description

@yann-eugone

Description

Deprecations are presented as replacement for api versioning.
ApiPlatform provide way to deprecate both Resource, Operation and Properties.

But I was not able to find any way to deprecate Filters, although this is often something that may evolve.

Example

<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
+ use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter;

/**
 * @ApiResource()
- * @ApiFilter(SearchFilter::class, properties={"id": "exact", "price": "exact", "description": "partial"})
+ * @ApiFilter(SearchFilter::class, properties={"description": "partial"})
+ * @ApiFilter(RangeFilter::class, properties={"price"})
+ * @ApiFilter(SearchFilter::class, properties={"id": "exact"}, deprecationReason="Use get operation instead")
+ * @ApiFilter(SearchFilter::class, properties={"price": "exact"}, deprecationReason="Use range filter instead")
 */
class Offer
{
}

The filter is still present, but should be deprecated using OpenAPI:v3 Parameter Object deprecated field name :

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions