core icon indicating copy to clipboard operation
core copied to clipboard

Allow applying filters on relations

Open Coffee2CodeNL opened this issue 2 months ago • 0 comments

Description
Add some native and easy to use way to allow to filter on relations of a resource, for instance applying filters on a Category resource with a OneToMany relationship to a Product resource, and only returning the products matching that filter.

Example
Something along the lines of

search[products.name]="egg"

Which would be defined as

'search[:property]'      => new QueryParameter(
    openApi: new Parameter(
        name: 'search[:property][]',
        in: 'query',
        description: 'A fuzzy filter<br />Fields: `name`, `description`'
    ),
    filter: new PartialSearchFilter(),
    properties: ['name', 'description']
),

Which would return a subset of Products on the Category resource matching the filter:

{
  "@context": "/contexts/Category",
  "@id": "/categories/12",
  "@type": "Category",
  "name": "Category Name",
  "products": [
    "/products/1",
    "/products/5",
    "/products/7"
   ]
}

Coffee2CodeNL avatar Dec 10 '25 07:12 Coffee2CodeNL