Skip to content

Support for specifying defaultValue using Kotlin's default value #3009

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

Closed
sivaprasadreddy opened this issue May 27, 2025 · 1 comment
Closed
Labels
invalid This doesn't seem right wontfix This will not be worked on

Comments

@sivaprasadreddy
Copy link

With Spring Boot + Kotlin, I can specify a default value for a request parameter in 2 ways:

//Using defaultValue attribute
fun getAll(@RequestParam(defaultValue = 1) page: Int) = ...

//Using Kotlin's default method argument value features
fun getAll(@RequestParam page: Int = 1) = ...

Both of these approaches works fine.
However, when the Open API docs are generated, the default value is showing up correctly only when getAll(@RequestParam(defaultValue = 1) page: Int) syntax is used, but not for getAll(@RequestParam page: Int = 1).

Please support generating the Swagger docs with default value when Kotlin's default value assignment syntax is used as well.

@mymx2
Copy link

mymx2 commented May 28, 2025

not support.

code shows how kotlin generated Java bytecode:
Image

@bnasslahsen bnasslahsen added invalid This doesn't seem right wontfix This will not be worked on labels Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants