request-input-bundle icon indicating copy to clipboard operation
request-input-bundle copied to clipboard

Query parameters DTO

Open Alexandre-Fernandez opened this issue 2 years ago • 1 comments

It would be nice if you could create a DTO to retrieve and validate all the query parameters from $request->query.

#[Route("/test", name: "test", methods: ["GET"])]
public function registration(
    BodyDto $bodyDto // implements `InputInterface`, retrieves and validates the request's body
    QueryDto $queryDto  // implements `QueryInputInterface` retrieves and validates the request's query parameters
): Response {
    // ...
}

If this change is made InputInterface may need a rename to something like BodyInputInterface (or something like that) to signal the difference with the query parameter version.

Alexandre-Fernandez avatar Apr 13 '23 09:04 Alexandre-Fernandez

Thanks @Alexandre-Fernandez.

In fact, i was thinking about it where query paramerters are usually used as filters.

I will try to add it in v2

sfmok avatar Apr 17 '23 19:04 sfmok