I am using version 3.3 and following the documentation, I try to define a @QueryParam that is strict as follows:
@QueryParam(name="bookId", requirements="^\d+$", nullable=false, strict=true, description="The ID of the book")
and expect to get an error if I do not send a valid bookId.
After reading this issue I understand that I will only get the error if I explicitly use the param with ParamFetcherInterface (for example, with $paramFetcher->get('bookId')).
This works fine. However, in my case (and in many others I assume), I do not use the parameter in the controller itself, but in another service, and it feels very unnatural to request the parameter with something like $bookId = $paramFetcher->get('bookId') and leave this variable unused.
For these reasons I think it would be useful to have a configuration value to allow validation without explicitly requesting the parameters. Please let me know if I am misunderstanding the usage and/or if my request makes sense to you as well.
I am using version 3.3 and following the documentation, I try to define a @QueryParam that is strict as follows:
@QueryParam(name="bookId", requirements="^\d+$", nullable=false, strict=true, description="The ID of the book")
and expect to get an error if I do not send a valid bookId.
After reading this issue I understand that I will only get the error if I explicitly use the param with
ParamFetcherInterface
(for example, with$paramFetcher->get('bookId')
).This works fine. However, in my case (and in many others I assume), I do not use the parameter in the controller itself, but in another service, and it feels very unnatural to request the parameter with something like
$bookId = $paramFetcher->get('bookId')
and leave this variable unused.For these reasons I think it would be useful to have a configuration value to allow validation without explicitly requesting the parameters. Please let me know if I am misunderstanding the usage and/or if my request makes sense to you as well.
Thanks in advance