Skip to content

[GraphQL] ExistsFilter and SearchFilter can not be defined on the same property #2231

Closed
@epourail

Description

@epourail

When a resource is defined with an ExistsFilter and a SearchFilter on the same property, the graphql schema will convert both filters in the same way using the property name to identify the filter.

In the following example

/**
 * @ApiResource()
 * @ApiFilter(ExistsFilter::class, properties={"title"})
 * @ApiFilter(SearchFilter::class, properties={"title": "exact"})
 */
class Dummy
{
   /** @var null|string $title a nullable property */
   private $title;

   // ...
}

The REST collection endpoint enables both filter with the syntax /dummies?title=shirt and /dummies?title[exists]=true

But the GraphQL endpoint enables only the SearchFilter with the syntax dummies(title: "shirt") { ... }
(as the ExistFilter uses the syntax dummies(title: {exists: true}))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions