ScaCap / spring-auto-restdocs

Spring Auto REST Docs is an extension to Spring REST Docs
https://scacap.github.io/spring-auto-restdocs/
Apache License 2.0
310 stars 86 forks source link

Kotlin not nullable with default info marked as Optional False #416

Closed Athas1980 closed 3 years ago

Athas1980 commented 4 years ago

Hi Consider the following data class

data class Person(val firstName:String, val lastName:String = "")

The lastName field will be marked as required in the documentation, even though the value will actually be the empty String.

I've looked at some classes and it appears that its set like this due to jacksons marking as as required.

jmisur commented 4 years ago

Please try this config and let us know if it works https://github.com/FasterXML/jackson-module-kotlin/issues/130#issuecomment-546625625

Edit: actually it's a bit different issue, I'm not sure it will help. We cannot do much here as this is heavily dependent on jackson and kotlin module.

Athas1980 commented 3 years ago

Sorry I didn't get around to testing this. At the moment I've made all my fields nullable to work around this.

jmisur commented 3 years ago

Let's reopen if more people hit this.