You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We've got some large projects that we are gradually converting to Kotlin. For those projects we have a mix of Java and Kotlin rest controllers.
Under 2.0.2 in the Java controllers the required parameter of @RequestParam was honoured. Under 2.0.3 / 2.0.4 it appears that this parameter is completely ignored. Furthermore adding in a @Parameter(required = false) annotation has no effect either.
So
Expected behavior
We weren't expecting the upgrade of spring boot / spring docs to change the OpenAPI documentation for of all our Java controllers. The fix appears to be either to convert all our controllers to Kotlin or setting
The latter change then means that we can't take advantage of the improvement in #2006 in our Kotlin controllers.
It also seems odd that the upgrade should change the behaviour in this way, perhaps the code should take into account whether it is a Java controller and if so then not to look at the nullability of the parameter to determine if it is required.
The text was updated successfully, but these errors were encountered:
Hi @bnasslahsen thanks for the quick fix. I've tested the latest snapshot and it fixes the bug, but then discovered that the issue also exists for request headers too so have raised #2187.
Describe the bug
We've got some large projects that we are gradually converting to Kotlin. For those projects we have a mix of Java and Kotlin rest controllers.
Under 2.0.2 in the Java controllers the
required
parameter of@RequestParam
was honoured. Under 2.0.3 / 2.0.4 it appears that this parameter is completely ignored. Furthermore adding in a@Parameter(required = false)
annotation has no effect either.So
always generates a required parameter:
To Reproduce
Actual is
Expected is
Sample controller is
Sample project demonstrating the issue (including test case) can be found at https://github.com/petergphillips/springdoc-optional-parameters.
Expected behavior
We weren't expecting the upgrade of spring boot / spring docs to change the OpenAPI documentation for of all our Java controllers. The fix appears to be either to convert all our controllers to Kotlin or setting
The latter change then means that we can't take advantage of the improvement in #2006 in our Kotlin controllers.
It also seems odd that the upgrade should change the behaviour in this way, perhaps the code should take into account whether it is a Java controller and if so then not to look at the nullability of the parameter to determine if it is required.
The text was updated successfully, but these errors were encountered: