sfmok / request-input-bundle

RequestInputBundle converts request data into DTO inputs objects with validation.
MIT License
37 stars 0 forks source link

Query parameters DTO #13

Open Alexandre-Fernandez opened 1 year ago

Alexandre-Fernandez commented 1 year ago

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.

sfmok commented 1 year ago

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