Skip to content

Require argument for custom filter #2113

@alifs-dev

Description

@alifs-dev

Hello,
I've a custom filter with a topic parameter.
When i call the endpoint /articles/latest, when topics parameter is not required, the default api platform controller is executed.
But when i fill the topics parameter, the filter class is executed.
Is it normal ?

Thanks

 *     attributes={
 *         "filters"={ArticlesFilter::class},
 *     },

 *         "api_articles_get"={
 *             "method"="GET",
 *             "path"="/articles/latest",
 *             "pagination_items_per_page"=3,
 *             "normalization_context"={
 *                 "groups"={"view_latest_articles"}
 *             },
 *             "swagger_context"={
 *                  "parameters"={{"name"="topics","in"="query","required"=false,"type"="string","description"="..."}}
 *             }
 *         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions