New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueryParam. Scrict option does not work in case with map(array) #1654
Comments
Hi, I have exactly the same problem and I expected the described behavior. Thanks |
I think this is not about "strict=true" but about "nullable=false" not behaving as expected (same as issue #1765 and probably also related: #1785). The NotNull constraint is only applied to the array elements, not the param itself, which is unexpected. I don't know what and when exactly this changed, because we upgraded from 1.8 to 2.3 and somewhere in between this seems to have changed :( |
Here is the relevant code from v1.8: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/1.8/Request/ParamFetcher.php#L166 There a BadRequestHttpException "%s parameter value of '%s' is not an array" was thrown when we had "array=true" and "nullable=false". In newer versions, this behaviour changed (and as far as I see not documented). |
Does #1769 fix this? |
Hi.
I have this annotation:
@QueryParam(map=true, name="ids",requirements="\d+", strict=true, nullable=false)
for this url
/test?ids[]=1&ids[]=2&ids[]=3
so, I assume that there should be an error when I'm trying to use such url:
/test
withoutids
in query string.But, unfortunately I can pass validation by this url :(
am I doing something wrong?
For me it looks like option
strict
does not work for arrays"friendsofsymfony/rest-bundle": "^2.1"
The text was updated successfully, but these errors were encountered: