Looks like the property from sealed class is always last despite SORT_PROPERTIES_ALPHABETICALLY is set to true.
val om = jacksonObjectMapper().apply { configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
}
fun main() {
om.writeValueAsString(Test(2, 1)) // {"a":1,"b":2}
val user = User.Customer(UUID.fromString("7c183904-63f7-40d3-936b-7f4ae7f96189"))
om.writeValueAsString(user) // {"userId":"7c183904-63f7-40d3-936b-7f4ae7f96189","type":"customer"}
}
data class Test(
val b: Int,
val a: Int
)
sealed class User(val type: String) {
data class Customer(val userId: UUID) : User("customer")
data class Employee(val email: String) : User("employee")
}