Page Contents

Home > @loopback/openapi-v3 > param > filter

param.filter() function

Sugar decorator for filter query parameter

Signature:

function filter(modelCtor: typeof Model, options?: string | (FilterSchemaOptions & {
        name?: string;
    })): (target: object, member: string, index: number) => void;

Parameters

Parameter Type Description
modelCtor typeof Model Model class
options string | (FilterSchemaOptions & { name?: string; }) (Optional) Options to customize the parameter name or filter schema

Returns:

(target: object, member: string, index: number) => void

Example

async find(
  @param.filter(modelCtor)) filter?: Filter<T>,
): Promise<(T & Relations)[]> {
  // ...
}