Skip to content

In Kotlin @RequestBody required=false when use default arguments #12691

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
raderio opened this issue Mar 30, 2018 · 2 comments
Closed

In Kotlin @RequestBody required=false when use default arguments #12691

raderio opened this issue Mar 30, 2018 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@raderio
Copy link

raderio commented Mar 30, 2018

fun test(@RequestBody reg: Register?): String {
    return "test"
}

When we do not send any data this works, because it add required=false in @RequestBody

fun test(@RequestBody reg: Register = Register()): String {
    return "test"
}

In this case, with default arguments, when we do not send any data, it does not work.

Add required=false in @RequestBody when use default arguments in Kotlin

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 30, 2018
@bclozel
Copy link
Member

bclozel commented Mar 30, 2018

Thanks @raderio , but this is already being tracked in the Spring Framework issue tracker; see SPR-16598. This will be supported in the upcoming Spring Framework 5.1.

@bclozel bclozel closed this as completed Mar 30, 2018
@bclozel bclozel added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 30, 2018
@raderio
Copy link
Author

raderio commented Mar 30, 2018

Ok, thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants