Fosrestbundle: "default" parameter not parsed in some cases

Created on 23 Nov 2016  路  2Comments  路  Source: FriendsOfSymfony/FOSRestBundle

When using a QueryParam annotation and having nullable set to true and strict to true it seems that the "default" parameter is not parsed.

e.g.:

@RestAnnotations\QueryParam(name="items_per_page", requirements="\d+", strict=true, nullable=true, default="1000")

Everything is OK. If "items_per_page" parameter is set, the requirements will be checked strictly, if not, the null value will be used.

But if I write the following:

@RestAnnotations\QueryParam(name="items_per_page", requirements="\d+", strict=true, nullable=true, default="%pagination.items_per_page.default%")

An error occurs even if the parameter is not set. I guess that the validator validate the default value and this one is not parsed in this case, so the string "%pagination.items_per_page.default%" doesn't match the requirements.

Most helpful comment

https://github.com/FriendsOfSymfony/FOSRestBundle/pull/1568 wasn't available in a stable version.
I released new patches, you just need to upgrade :)

Thanks for the report!

All 2 comments

https://github.com/FriendsOfSymfony/FOSRestBundle/pull/1568 wasn't available in a stable version.
I released new patches, you just need to upgrade :)

Thanks for the report!

Thanks to you!

Was this page helpful?
0 / 5 - 0 ratings