Field names are being lowercased automatically when the first word of the camel-case is too short
I don't know if this is a feature or a bug but a quick search didn't return anything (or I didn't see it), or if this is something that only happens for Kotlin users.
I am using 2.12.4 but just in case, my POM has
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.12.4</version>
</dependency>
</dependencies>
The following may be run in a scratch.kt
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
val m = ObjectMapper()
val j = jacksonObjectMapper()
data class A(val someValue: String = "")
data class B(val sValue: String = "")
data class C(val rPoi: String = "")
m.writeValueAsString(A("cow").also(::println)).also(::println)
m.writeValueAsString(B("cow").also(::println)).also(::println)
m.writeValueAsString(C("cow").also(::println)).also(::println)
The output shows that the fields with short first word in the camel-case are being lowercased
A(someValue=cow)
{"someValue":"cow"}
B(sValue=cow)
{"svalue":"cow"}
C(rPoi=cow)
{"rpoi":"cow"}
I currently don't have an issue with this but it stumped me for a while because some of my Apache Camel routes started failing. I fixed it simply by using longer first names and it just works as expected.
Please let me know if I should try some other version. This is very easy to test as all I have to do is spin up a scratch (IntelliJ/IDEA) file and run it.
Chances are this is due to Kotlin module's special handling of names, attempting to follow deviations Kotlin has from Java Beans specification (and sometimes from field-first aspect). So will transfer to Kotlin module; may be moved back if reproducible with plain Java test.
The issue of property names in the serialization result differing from the definition in Kotlin will be addressed in #630. This issue be closed as a duplicate.